Mouse drag script

the scripts works fine but it clips the object halfway through an object and stops where the mouse is, how would i make the script respect parts collision instead of the mouse?

local player = game.Players.LocalPlayer

local mouse = player:GetMouse()

local billBoardGui = script.Parent

local runService = game:GetService(“RunService”)
local isMoving = false

local movePart

local part = billBoardGui.Adornee

if not isMoving then isMoving = true
	movePart = runService.RenderStepped:Connect(function()
		mouse.TargetFilter = part 
	part.Position = mouse.Hit.Position
end)
else
	movePart:Disconnect()
	mouse.TargetFilter = nil
	isMoving = false

end

This is actually really complicated as you need some way of remembering where the part is being grabbed from. I have a tool for this here, the documentation also explains the problem: GridPlacer: Highly-featured module for part placement, rotation, and snapping to grid

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