How to fix pls help

robloxapp-20230228-2149119.wmv (622.6 KB)
how to fix this bug

while wait() do
workspace.Part.Position = game.Players.LocalPlayer:GetMouse().Hit.Position

The script looks like it works as intended. What bug are you referring to? You should be more descriptive.

I didn’t download the video. I’m assuming that the mouse hit is nil sometimes. Use an if statement to ensure that it is not nil.

local mouse = game.Players.LocalPlayer:GetMouse()
while task.wait() do
    local pos = mouse.Hit and mouse.Hit.Position
    if pos then
        workspace.Part.Position = pos
1 Like

the object moves constantly towards the camera when the mouse is not moving

Oh, then you should set the TargetFilter to the part. It’s glitching because your mouse is pointing to the part whose’s position is dependant on your mouse. It’s recursive and it will cause stuttering in the part.

1 Like

do you know how to make an object move through 1 studs

Do you mean you want it to move with a stud increment?

local grid = 3 -- 3 stud increment
-- later:
workspace.Part.Position =
1 Like

Thanks!!! for help this working

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.