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

Dragger/Locking a brick to a player's mouse?

So with the Dragger Object, I am wanting it to update its position every 0.01 studs (or lower than the current: 1).

This is the code I'm using:

mouse.Move:connect(function()
	dragger:MouseMove(mouse.UnitRay)
end)

The dragger works correctly, although the part moves every 1 stud and I am not sure how to lower it.

EDIT:

I simplified it all so I could use this:

mouse.Move:connect(function()
	part.CFrame = mouse.Hit
end)

Although the outcome is as shown: https://gyazo.com/e8bc886a85830349d77e42ae34799ff8.gif

2 answers

It is actually a simple fix

mouse.TargetFilter = part

mouse.Move:connect(function()
    part.CFrame = mouse.Hit
end)

You'll need to set the target filter in order for it to stop "moving" towards the camera, which ignores the object and all its descendants when determining what part the mouse is on:

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.TargetFilter = part
mouse.Move:connect(function()
part.CFrame = mouse.hit
end)

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