Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make this keep your original walkspeed?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Decemus 141
10 years ago

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
0
Don't forget the 'end' Merely 2122 — 10y
0
You forgot when using 'if' statements you have to use a double equal 'if something1 == something2 then end'. TheeDeathCaster 2368 — 10y
0
This really doesn't help me too much. TheRings0fSaturn 28 — 10y
Ad
Log in to vote
0
Answered by
Emg14 10
10 years ago

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!!!

Answer this question