local movePart = workspace.MovePart
local wall = workspace.Wall
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Move:connect(function()
--configureWall()
mouse.TargetFilter = movePart
if mouse.Target then
print("There was a target.")
movePart.Position = mouse.Hit.Position
movePart.CFrame += movePart.CFrame.LookVector * 1
end
wait()
end)
It’s supposed to move the part where the mouse is pointing and it does that but I want to move it by 5 studs only, not 0 studs which is what it’s doing now. Thanks for the help.
Maybe check the magnitude between the Player and the Mouse Hit Position?
If it’s below 5 studs, the player can move it, if not stop it
E.x.
if (game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart").Position - Mouse.Hit.Position) < 5 and not (game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart").Position - Mouse.Hit.Position) > 5 then
-- things
end
And use RenderStepped instead of Mouse.Move, it’s better.
Thank you, but what I mean is that I want a part to move where the mouse is pointing (so using mouse.Hit) on another part, just not following it smoothly with 0 studs but following the mouse every 5 studs. I hope that makes sense.