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

help with moving models?

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

✓ Accepted answer
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.

1 comment

0

thank you, now all i need to do is get them moving in grids...

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