Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My script won't rotate model?

Asked by
Mr1Vgy 30
9 years ago

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

Log in to vote
-1
Answered by 9 years ago

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)
Ad

Answer this question