Hello !
So, like the title says, the script stops when I die. I recently installed a footstep system in ServerScriptService. In the output, I saw that it’s from a script called running. So here are the configuration and scripts into my workspace ;

I have to precise that i’m highly limited into scripting and that I want to fix it very fast. I know that I can copy the script maybe and destroy the current one when I die, but I don’t know how to do it and where to place it…
“Footstep” script :
--poner en ServerScriptServicie o Workspace
--[[
Foorsteps para R6 y R15....
este script nosirve mucho para filtering enabled por lo cual no es recomendado usar este
script para places con FE
--CREDITOS: iiMAYK
--CREDOTOS: Xx_andresXx
--]]
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
local x = script:GetChildren()
if c:FindFirstChild('Sound') then
c.Sound:Destroy()
end
for i = 1, #x do
if x[i]:IsA('Script') then
local e = x[i]:Clone()
e.Parent = c.HumanoidRootPart
e.Disabled = false
else
x[i]:Clone().Parent = c.HumanoidRootPart
end
end
local r = c.Head:GetChildren()
for i = 1,#r do
if r[i]:IsA('Sound') then
r[i]:Destroy()
end
end
end)
end)
“Runing” script : (I’m really sure that the problem comes from here)
local running = true;
local Connection = nil;
local Humanoid = script.Parent.Parent.Humanoid
function WhileRunning()
if script.Parent.Materials.Value == "Grass" then
script.Parent.Grass:Play()
elseif script.Parent.Materials.Value == "Water" then
script.Parent.Splash:Play()
elseif script.Parent.Materials.Value == "Wood" then
script.Parent.Wood:Play()
elseif script.Parent.Materials.Value == "Ice" then
script.Parent.Ice:Play()
elseif script.Parent.Materials.Value == "Plastic" then
script.Parent.Plastic:Play()
elseif script.Parent.Materials.Value == "WoodPlanks" then
script.Parent.WoodPlanks:Play()
elseif script.Parent.Materials.Value == "Cobblestone" then
script.Parent.Cobblestone:Play()
elseif script.Parent.Materials.Value == "Fabric" then
script.Parent.Fabric:Play()
elseif script.Parent.Materials.Value == "CMetal" then
script.Parent.Diamond:Play()
elseif script.Parent.Materials.Value == "Metal" then
script.Parent.Metal:Play()
elseif script.Parent.Materials.Value == "DiamondPlate" then
script.Parent.Diamond:Play()
elseif script.Parent.Materials.Value == "Concrete" then
script.Parent.Concrete:Play()
elseif script.Parent.Materials.Value == "Slate" then
script.Parent.Concrete:Play()
elseif script.Parent.Materials.Value == "Foil" then
script.Parent.Foil:Play()
elseif script.Parent.Materials.Value == "Brick" then
script.Parent.Brick:Play()
elseif script.Parent.Materials.Value == "Granite" then
script.Parent.Granite:Play()
elseif script.Parent.Materials.Value == "Marble" then
script.Parent.Marble:Play()
elseif script.Parent.Materials.Value == "Sand" then
script.Parent.Sand:Play()
elseif script.Parent.Materials.Value == "Pebble" then
script.Parent.Pebble:Play()
elseif script.Parent.Materials.Value == "Pebble" then
script.Parent.Pebble:Play() end
end
function isRunning()
if running and Humanoid.Parent.HumanoidRootPart.Velocity.magnitude > 1 then
return true
end
end
Humanoid.Jumping:connect(function()
running = false;
end)
function doWhileRunning()
Connection:disconnect();
running = true;
while (isRunning()) do
WhileRunning()
wait(0.351)
end
running = false;
Connection = Humanoid.Running:connect(doWhileRunning);
end
Connection = Humanoid.Running:connect(doWhileRunning)
The thing that “running” returned when I died ;
22:46:47.810 - Stack Begin
22:46:47.810 - Script 'Workspace.TheFirm_F.HumanoidRootPart.Running', Line 25 - function WhileRunning
22:46:47.811 - Script 'Workspace.TheFirm_F.HumanoidRootPart.Running', Line 64 - function doWhileRunning
22:46:47.812 - Stack End
Thanks for helping ! 