Help! When the play clicks x for the second time and the items are brought in they cannot be deselected when selected causing them all to stack onto each other.
wait(1)
print("Loaded")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local character = Player.Character
local Tools = Player.Backpack
local startgear = Player.StarterGear
function makegearstart()
for i,v in pairs(Tools:GetChildren()) do
v:clone().Parent = startgear
end
end
makegearstart()
-------------------------------------------
function speed(speed)
character.Humanoid.WalkSpeed = speed -- speed function
end
function holdingtool()
for _, child in pairs(character:GetChildren()) do
if child.ClassName == "Tool" then
child:remove()
end
end
end
function givebacktool()
for i,v in pairs(startgear:GetChildren()) do
v:clone().Parent = Tools
end
end
Mouse.KeyDown:connect(function(Key) -- main thing
if Key == "x" then
if character.Humanoid.WalkSpeed > 0 then
speed(0)
Tools:Remove()
holdingtool()
else
speed(16)
givebacktool()
end
end
end)
Do you know how to fix this? Thanks.

3 comments
Give a description of your script too so that we know what your trying to do
https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online
On line 44 --Tools:ClearAllChildren() --You have defined a path to the Backpack, which to my knowledge can't be removed so easily. This will remove everything in it.