Walkspeed reverts when player dies

  1. Hi, my script checks the player’s “Rebirth” leaderstat value on connection and changes their walk speed dependent on this value. My intent is to have this walk speed value persist when the player dies, currently it does not, unbeknownst as to why.
game.Players.PlayerAdded:Connect(function(player)
	
	local char = player.Character or player.CharacterAdded:wait()
	
	if player.leaderstats.Rebirth.Value == 1 then
		
		wait(1)
		
		char.Humanoid.WalkSpeed = 40
		
	end
	
end)
1 Like
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if Player.leaderstats.Rebirth.Value == 1 then	
			wait(1)
			Character.Humanoid.WalkSpeed = 40	
		end
	end)
end)

Resource Player | Roblox Creator Documentation

1 Like

Thank you so much for your time.