I have in the starter player a local script with this script in it:

plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
target = {}
function click()
if mouse.Target then
if mouse.Target:IsA("Part" or "UnionOperation") and mouse.Target.Locked == false then
target.part = mouse.Target
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
end)
end
end
end
mouse.Button1Down:connect(click)

How do you make it so that the brick can only be picked up when the player is 10 studs from it, how to make it so the part doesn't go to far from the player, and how do you specify the part that can be picked up in this script?

1 comment

0

part.Position.magnitude