mouse.Move:connect(function() if mouse.Target then if mouse.Target.Name ~= "floorpart" then while wait() do workspace.Desk1:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p.X-mouse.Hit.p.X%1,1.5,mouse.Hit.p.Z-mouse.Hit.p.Z%1)) end end end end)
When I move the mouse, the object starts to shake. wherein. Although if you move the mouse very close to the player, then everything is okay. Whats wrong?
Make sure workspace:FindFirstChild("Desk1")
is anchored,
Also :connect
is deprecated
use :Connect
instead.
Here is the fixed script
:
mouse.Move:connect(function() if mouse.Target then if mouse.Target.Name ~= "floorpart" then local desk1 = game:GetService("Workspace"):FindFirstChild("Desk1") desk1["Anchored"] = true while wait() do desk1:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p.X-mouse.Hit.p.X%1,1.5,mouse.Hit.p.Z-mouse.Hit.p.Z%1)) end end end end)