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

Why does the speed value go up by a random number instead of 1?

local Player = game.Players.LocalPlayer
Player.Character.Humanoid.Running:Connect(function(speed)
	if speed > 0 then
		while wait(2) do
		Player.Stats.Speed.Value = Player.Stats.Speed.Value + 1
		end
	end
end)

1 comment

0

a player’s default speed is at 16

1 answer

local Player = game.Players.LocalPlayer
Player.Character.Humanoid.Running:Connect(function(speed)
    if speed > 0 then
        while wait(2) do
        Player.Stats.Speed.Value = Player.Stats.Speed.Value + math.random(1,100) -- set 100 to any amount you want
        end
    end
end)

Basically, math.random() chooses a random number from the first number to the second, so it would choose 1 through 100.

1 comment

0

I want it to go up by one but its going up by a random number instead .

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