of     1   

MrJoeyJoeJoey
#141283408Wednesday, July 23, 2014 4:34 PM GMT

I have this turret, and I want to make it look at the mouse. This works perfectly if it's only one part. So I tried welding the extra parts on and that didn't work(Stupidly). So now I've deiced to use a model rotater, but I can't figure how how to make the model point towards the mouse.Hit.p --Rotate model function local function RotateModel(model,center,axes) local origin={} for _,child in pairs(model:GetChildren()) do if child:IsA"BasePart" then origin[child]=center:toObjectSpace(child.CFrame) end end center=center*CFrame.fromEulerAnglesXYZ(unpack(axes)) for part,cf in pairs(origin) do part.CFrame=center:toWorldSpace(cf) end end RotateModel(MODEL,MODEL:GetModelCFrame(),{math.rad(90),math.rad(90),math.rad(90)}) -- Calling the function --What I'm currently useing cannon.Main.CFrame=CFrame.new(cannon.Main.Position,mouse.Hit.p)
MrJoeyJoeJoey
#141284958Wednesday, July 23, 2014 4:52 PM GMT

Okay, I tried this, and it didn't point at the position. it just went crazy RotateModel(cannon,cannon:GetModelCFrame(),{math.rad(mouse.Hit.X),math.rad(mouse.Hit.Y),math.rad(mouse.Hit.Z)}) end

    of     1