I'm trying to make a building system and whenever i move my mouse it gets closer to the camera and it glitches out. Help? ):
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.Move:connect(function() position = mouse.hit.p game.Workspace.Part.Position = position end)
What is happening is that the mouse is hitting the brick you are moving, making it get closer and closer to you every time the event is fired.
There is a solution though, a target filter.
All you have to do is set mouse.TargetFilter
to what ever object you want the mouse to ignore (including all of it's descendants):
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.TargetFilter = OBJECT_TO_IGNORE mouse.Move:connect(function() position = mouse.hit.p game.Workspace.Part.Position = position end)