Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script won't rotate model?

Ok so I have this script that is supposed to rotate a model in the direction of where the player's moue clicked. It won't work because I can't get the model to rotate. Does anyone know how to make a model rotate?

c = game.Workspace.CurrentCamera.circle
s = game.Workspace.Boat

m.Button1Down:connect(function()
	if m.Hit == nil then return end
	c.Position = m.Hit.p
	
	s.Mid.Rotation = s.Mid.Rotation * CFrame.fromEulerAnglesXYZ(0, 90, 0)
	end)
end)

This is in a LocalScript.

1 answer

✓ Accepted answer

Try the following...

c = game.Workspace.CurrentCamera.circle
s = game.Workspace.Boat
 
m.Button1Down:connect(function()
    -- if m.Hit == nil then return end << you don't need this, Hit cannot be nil.
    c.Position = m.Hit.p
 
    s.Mid.CFrame = CFrame.new(s.Mid.CFrame.p, m.Hit.p) -- creates a CFrame of the position of "Mid", facing Hit
    end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.