Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why when I die, the walkspeed does not save?

So I made a script saying if you have one coin, walkspeed is = 21

local players = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function(Click)
	if players.leaderstats.Coins.Value >= 1 then
		players.leaderstats.Coins.Value = players.leaderstats.Coins.Value - 1
		
		players.Character.Humanoid.WalkSpeed = 21
	end
end)

But it came to my attention that when you die, your walkspeed get reset. can you help me?

1 comment

0

But it came to my attention that when you die, your walkspeed resets. can you help me?

1 answer

✓ Accepted answer
local players = game.Players.LocalPlayer
local thews = "something idk make it a numvalue"
script.Parent.MouseButton1Click:Connect(function(Click)
    if players.leaderstats.Coins.Value >= 1 then
        players.leaderstats.Coins.Value -= 1

        players.Character.Humanoid.WalkSpeed = 21
	thews = 21
    end
end)

players.CharacterAdded:Connect(function(c)
	c:WaitForChild("Humanoid").WalkSpeed = thews
end)

-- whenever their character is added it will wait for their humanoid and set their walkspeed accordingly

This discussion is preserved as it was. New answers, comments, and votes are closed.