I have these weights. When I unequip them it is supposed to return them to their original spots. The handle disappears from the tool and it stays in my backpack. I also get something in the output saying -
"16:26:48.820 - Something unexpectedly tried to set the parent of Weights to NULL while trying to set the parent of Weights. Current parent is Backpack."
Anyways here is the code. Thanks in advance
Code inside tool
local tool = script.Parent
local handle = tool:WaitForChild('Handle')
local loop
game.Players.PlayerAdded:Connect(function(plr)
tool.Equipped:Connect(function()
loop = true
local p = workspace:WaitForChild(plr.Name)
local waittime = plr.WaitTime.WaitTimeStr
local Power = plr:WaitForChild('Stats'):WaitForChild('Power')
repeat
wait(waittime.Value)
Power.Value = Power.Value + 1
waittime.Value = waittime.Value + 1
until loop == false
end)
tool.Unequipped:Connect(function()
loop = false
local newHold = tool:Clone()
plr.Backpack:WaitForChild('Weights'):Destroy()
newHold.Parent = game.Workspace
newHold.Name = 'Weights'
newHold.Handle.Position = Vector3.new(208.402, 3, 42.727)
end)
end)
Code inside Handle
local part = script.Parent
game.Players.PlayerAdded:Connect(function(plr)
local function OnTouched(hit)
if hit.Parent.Name == plr.Name then
part.Parent = plr.Backpack
end
end
end)
