So here is a script that enables the player to click and drag a unioned part. What is necessary to add to this to make sure players are not able to drag the part from a certain distance?
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
target = {}
script.Parent = game.StarterPlayer.StarterPlayerScripts
function click()
if mouse.Target then
if mouse.Target:IsA("UnionOperation") and mouse.Target.Locked == false then
target.part = mouse.Target
target.anchored = target.part.Anchored
target.part.Anchored = true
dim = true
mouse.Move:connect(function()
if dim then
target.part.CFrame = CFrame.new(
mouse.Hit.X,target.part.CFrame.Y,mouse.Hit.Z)
elseif not dim then
end
end
)
mouse.Button1Up:connect(function()
dim = false
target.part.Anchored = target.anchored
end)
end
end
end
mouse.Button1Down:connect(click)

2 comments
Thank you for the help! I inserted it but it says that position is not a valid member of a part. How do I resolve that problem?
Never mind! It was a typo! I got the script working and it is truly amazing! Thank you for helping me with this! Have a great day! :D