I’m using this system here https://devforum.roblox.com/t/dragging-objects-with-the-mouse/403766 for a game I’m making! Every little bit or so, my “draggable” blocks will return to their original positions so they don’t get lost, make a mess, etc. This part is the issue…
It sends me about 1 bajillion errors in the console. specifically over line 109 in the DraggableModule. I think I understand why, it’s because it moves out of the distance it was before when it’s being dragged around by a player, so the system struggles to calculate where the part should be or something and goes koo koo.
I don’t really know how to make this issue stop, I’m pretty newb to scripting and this is kind of advanced for me ahah. If there’s any way to make the script recognize when a part leaves a certain distance and just force the player to drop it, or something like that it might help, but I really don’t in-depth understand what it wants from me. I’ve had no other problems with this system really, it does exactly what I want but this monstrous mountain of errors is a pain in the neck.
Here’s line 109 and the few strings beneath it
local result = RayCast(distance, {target.Parent or target, holdGrip})
local cframe = CFrame.new(result and result.Position or character.Head.Position + ((mouse.Hit.Position - character.Head.Position).Unit * distance))
attachment1.WorldCFrame = (cframe * CFrame.Angles(cframe:ToEulerAnglesXYZ()):Inverse()) * (attachment1.WorldCFrame - attachment1.WorldCFrame.Position) * newOrientation
end)