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

Can I have help on a part moving to the cursors postion?

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local PosX,PosY,PosZ = Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z
while wait (0.01) do
	game.Workspace.Part.Position = Vector3.new(PosX,PosY,PosZ)
end

I can not figure out everything seems right any ideas on whats wrong? (Is a local script in Player GUI)

1 answer

✓ Accepted answer

You are not updating the cursor position every hundredth of a second. Try this!

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

while wait (0.01) do
    local PosX,PosY,PosZ = Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z
    game.Workspace.Part.Position = Vector3.new(PosX,PosY,PosZ)
end

If this helped, be sure to mark me as a solution. If not, please post why and I will get back to you as soon as possible. Thanks!

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