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

help with moving models?

Asked by 8 years ago
player = game.Players.LocalPlayer
mouse = player:GetMouse()
m = Instance.new("Message",player.Character)
m.Name = 'short'
game.Workspace.Model.Parent = m
mouse.Move:connect(function()
    player.Character.short:WaitForChild("Model"):SetPrimaryPartCFrame(mouse.Hit)
end)

this script makes a model move wherever the mouse is pointing, the only problem is that the model is rotated in accordance to the players camera, try it out and see what i mean. So how do i have the model be not weirdly rotated?

1 answer

Log in to vote
4
Answered by 8 years ago
player.Character.short:WaitForChild("Model"):SetPrimaryPartCFrame(mouse.Hit)

This line of code sets the model's (primary part's) CFrame. That means both position and rotation. If you want to set only position, try SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p)). It'll create a new CFrame with no rotation.

0
thank you, now all i need to do is get them moving in grids... ScriptsAhoy 202 — 8y
Ad

Answer this question