How would I index the old WalkSpeed of a humanoid?

Hello! I’d like to index the old walkspeed of a humanoid, because I’m making a stun script (it sets the walkspeed to 0, then after a certain period of time it returns it to the normal walkspeed).

Any ideas?

1 Like

Simply store it as a variable then set the walkspeed, then set the walkspeed to the variable:

local WalkSpeed = Humanoid.WalkSpeed
Humanoid.WalkSpeed = 0
Humanoid.WalkSpeed = WalkSpeed

Do something like this:

--This will be the old value
local humanoidWalk = Humanoid.WalkSpeed
--Update every single time walk speed is changed.
Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
            if Humanoid.WalkSpeed ~= humanoidWalk then
            wait(ammount)
            Humanoid.WalkSpeed = humanoidWalk
            end
end)
Humanoid.WalkSpeed = 0

--Or you can do this if you just need it to work a time

local humanoidWalk = Humanoid.WalkSpeed
Humanoid.WalkSpeed = 0
wait(ammount)
Humanoid.WalkSpeed = humanoidWalk

thought that doesn’t actually index it, i’ll check it out soon