I did this: health = 10 while wait() do wait(2) health - 1 end This didn't work, in the script the minus was underlined red. What would I do to subtract a value if a minus didn't work?
In order to subract a value you will need to say health = health - 1
so that you are setting a new value on the health value. In your script, you would need the health variable to be equaled to something, such as the Player's health. I have provided a sample script with how to change a player's health from 10 to 0 over time.
game.Players.FearMeIAmLag.Character.Humanoid.Health = 10 health = 10 while wait(2) do health = health - 1 game.Players.FearMeIAmLag.Character.Humanoid.Health = health end
while wait(2) do
instead of while wait() do wait(2)
local health = 10 --Make newly assigned variables local while wait(2) do --No need to wait 2.03 seconds... health = health-1 --In order to change a value you need to use an "=" sign. --Health is the amount of health there is minus 1. end
Hope this helps!
Closed as Not Constructive by AmericanStripes
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?