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 this keep your original walkspeed?

It's part of my sprint script, and I was wondering instead of making it change it back to 16, if there was a way to make it keep your original walkspeed, so if you were to pick up a speed power up that gave you 36 walkspeed, and you sprinted, and you stopped, it'd make it stay at 36 until the script from the powerup reset your walkspeed to default. Here is the script:

mouse.KeyUp:connect(function(key)
	key = key:lower()
	if key == string.char(48) then
		character.Humanoid.WalkSpeed = 16
	end
end)

2 answers

I would suggest making a value and have an if statement to do so. For example,

if character.Powerup.Value = false then
character.Humanoid.Walkspeed = 16

3 comments

0

Don't forget the 'end'

0

You forgot when using 'if' statements you have to use a double equal 'if something1 == something2 then end'.

0

This really doesn't help me too much.

Pseudo Code:

--[[This is th powerup script]]
script.Parent.Touched:connect(function(part)
	--blalblballlbalb
	part.Parent.Humanoid.Speed = 36
	wait(5)
	--How any secs before the speed returns back to 16
	part.Parent.Humanoid.Speed = 16

If it helps, pls vote!!!

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