I want to make a script where when the player clicks on an unanchored object, the object flies towards the box that the player is holding. So I did this in a localscript
local plr = game.Players.LocalPlayer
local active = false
script.Parent.Equipped:connect(function(Mouse) --the parent of script.Parent is the tool
active = true
script.Parent.Mouse.Button1Clicked:connect(function()
if active==true and part.ClassName=='Part' then --part is supposed to be the thing that gets grabbed, but I havent made it into a working variable, which idk how
print('grab')
grabForce = instance.new('BodyForce')
grabForce.Force = Vector3.new('1,0,0') * 100
grabForce.Parent = part
end
end)
end)
script.Parent.Unequipped:connect(function()
active = false
end)
I havent figured it out yet, Idk if I am doing it right
