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

How to make a script that makes the players speed increase?

I want to make a game where every minute or second the player's speed increases until it hits a max speed. The game is just a obby but I thought that it would make it harder if the speed increased. I'm new to scripting so it would really help if you helped me!!!

1 comment

0

if my answer worked, please accept it

2 answers

Make sure this is a local script

local PlayerWS = game.Players.LocalPlayer.Humanoid.Walkspeed
local maxwalkspeed = 60 -- whatever you want

while wait(1) do -- every 1 second
    if not PlayerWS == maxwalkspeed then -- reached the max (maxwalkspeed)
        PlayerWS += 1 -- every second plus 1 walkspeed
   end
end

2 comments

0

TYSM!!!

0

np accept if it worked

Hi there. This is what you can do:

I'm PRETTY sure this should work. It might not.

Code:

local MaxSpeed = 30 --sets the maximum speed, and set this to what you want the maximum walkspeed should be

game.Players.PlayedAdded:Connect(function(Player) --event for when a player gets added, and assigns the added player to "Player"
	  	Player.CharacterAdded:Connect(function(Character) --event for the character, and sets the character to "Character"
		local Humanoid = Character:WaitForChild("Humanoid") --gets the humanoid, so we can change the walkspeed
		while true do --while loop
			Humanoid.WalkSpeed = Humanoid.WalkSpeed + 2 --your walkspeed will become two more than it was before, roblox's default is 16
			wait(10) --waits 10 seconds, then repeats
			if Humanoid.WalkSpeed >= MaxSpeed then --if the walkspeed is greater or equal to the maxspeed, we do greater or equal just incase something weird happens that it doesnt get recognized
				return --returns, which basically just doesnt do anything after
			end
		end
	end)
end)

As I said before, this might not work, but it should. Hope I helped you.

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