how do i make my group of things back to there normal walkspeed after changing it
heres what i got
1 | local Walkspeed = Target.Humanoid.WalkSpeed |
2 | Target.Humanoid:TakeDamage(_Damage.Value) |
3 | Target.Humanoid.WalkSpeed = 0 |
4 | wait(_icetime) |
5 | Target.Humanoid.WalkSpeed = Walkspeed |
they all have a dif walk speed i want them after they get iced to go back to original walkspeed
I'm not sure what you mean by "they"?
I would use a for loop
, and store their previous WalkSpeed
in a variable to refer back to after the wait(). I also can't use your variables so you'll have to modify my code to fit your needs.
01 | local Players = game:GetService( "Players" ) |
02 |
03 | for i,v in pairs (Players:GetPlayers()) do -- for loop |
04 | local char = v.Character or v.CharacterAdded:Wait() |
05 | local hum = char:WaitForChild( "Humanoid" ) |
06 | local oldWalkSpeed = hum.WalkSpeed -- Old WalkSpeed variable, i.e. 16 |
07 | print (oldWalkSpeed) |
08 |
09 | if hum then |
10 | hum.WalkSpeed = 0 -- WalkSpeed to 0 |
11 | wait(_icetime) |
12 | hum.WalkSpeed = oldWalkSpeed -- WalkSpeed to 16 |
13 | print (hum.WalkSpeed) |
14 | end |
15 | end |