This is the code, it works somewhat:
wait(1)
print("Loaded")
local Player = script.Parent.Parent
local Mouse = Player:GetMouse()
local character = Player.Character
local Tools = Player.Backpack
local startgear = Player.StarterGear
local replicatedStorage = game.ReplicatedStorage.Tools
local animation = script.Parent.Animation
local animTrack = character.Humanoid:LoadAnimation(animation)
function makeGearStart()
for i,v in pairs(Tools:GetChildren()) do
v:clone().Parent = replicatedStorage
end
end
makeGearStart()
-------------------------------------------
function setSpeed(speed)
character.Humanoid.WalkSpeed = speed -- speed function
end
function holdingTool()
for _, child in pairs(character:GetChildren()) do
if child.ClassName == "Tool" then
child:Destroy()
end
end
end
function giveBackTool()
for i,v in pairs(replicatedStorage: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
setSpeed(0)
Tools:ClearAllChildren()
holdingTool()
animTrack:Play()
else
setSpeed(16)
giveBackTool()
animTrack:Stop()
end
end
end)
But when the character resets it no longer works. The script is a local script in StarterPlayerScripts. Help make this work even after reset? Thanks

2 comments
Disable and reenable this from another script. That might fix it, but it's not a great solution.
I think I fixed it.