So I have a tool with which you can move boxes, but for some reason it only picks up a specific box, but they all named same.

localscript:

initiate = 2
alwaysactive = 1
anchor = 0
script.Parent.Equipped:connect(function(m)
m.Button1Down:connect(function()
anchor = 0
initiate = 2
if m.Target~=nil then
prop=nil	
_,prop=pcall(function() return game.Workspace.Items.Prop_Box end)
if prop~=nil then
local grabbed=prop
coroutine.wrap(function()
	if alwaysactive == 1 then
	local dist = (game.Players.LocalPlayer.Character.Torso.Position - prop.Position).magnitude
	if dist <10 then
		initiate = 1
        local c=prop
        while initiate == 1 do wait() pcall(function()
                prop.Anchored,prop.CFrame=true,game.Players.LocalPlayer.Character.Torso.CFrame*CFrame.new(0,0,-4.5)
                prop.CanCollide = false
        end) end	
        pcall(function() if anchor == 1 then c.Anchored=false else c.Anchored=true end c.CanCollide=true end)
	end
	end
end)()
else return false end
end
end)
end)

1 comment

0

Did you try print debugging or seeing the difference between the boxes? Which box is it? How is it different (if it is at all) from the others? Is it the same box every time?