I tried to create a script that when a player is low on health (20 health) their walkspeed will decrease and become 5 WalkSpeed. The original Walkspeed of the player is 20, not 16. This is my attempt of scripting it.
if script.Parent.Health >20 then
script.Parent.WalkSpeed = 5
wait()
if script.Parent.Health <20 then
script.Parent.WalkSpeed = 20
end
end
I dont know what I'm doing wrong, so some help would be great.

3 comments
Where is the script placed into?
https://developer.roblox.com/articles/Conditional-Statements-in-Lua
dont nest an if statement in there, the nested if statement isnt going to run in this instance, and a number cant be both greater than, and less than 20