My stun system involves storing the players walkspeed, setting their walkspeed to 0, then resetting it back when they leave stun.
Although this is fine normally, if the player has a speed boost, it’d simply save that value, allowing the player to slowly increase their base movement speed over and over again.
I was wondering what I should do about managing the players walkspeed because of this interaction, since I don’t want the player to lose their speed boost on hit when they leave stun by just resetting it back to their base value. Any ideas/recommendations appreciated
1 Like
For my walkspeed systems I base it on values and one client script controls a walkspeed, for example

and then to set is based those values,
in a loop
local DefaultSpeed = 16
for _,v:ValueBase in Variables.Character.WSReduce:GetChildren() do
DefaultSpeed -= v.Value
end
Variables.Humanoid.WalkSpeed = DefaultSpeed
so you could add your speed boost which is this case would be in the negatives since we’re subtracting so like 16- (-4) = 20
1 Like
You can use IntValues to monitor if the Player has a speed boost being applied to them, and the value added to their walkspeed.
When you restore the walkspeed after they get stunned, you can just add the value of the IntValue back to the Player’s walkspeed. You’ll need to have a seperate Script that keeps track of speed boosts and adjusts the IntValue accordingly, of course.
1 Like