|
| 10 May 2013 08:15 PM |
I need this to rapidly find if my Health is 0. But it says I need an end somewhere before then and I don't understand why.
Script:
Instance.new("Hint", game.Workspace) game.Workspace.Message.Name = "p" game.Workspace.p.Text = "Montanaontario2392 Is a GlowLight!" while true do if game.Workspace.montanaontario2392.Humanoid.Health == 0 then game.Workspace.p.Text = "Montanaontario2392 is no longer a GlowLight!" wait (4) game.Workspace.p :remove() game.Lighting.TimeOfDay="1:00:00" end |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 08:18 PM |
You need an end for the if structure as well as the while structure (so, two ends in this script). Also, you want to add a wait() OUTSIDE the if statement to prevent your place from crashing.
However, you're better off with events for this.
Instance.new("Hint", game.Workspace) game.Workspace.Message.Name = "p" game.Workspace.p.Text = "Montanaontario2392 Is a GlowLight!"
game.Workspace.montanaontario2392.Humanoid.HealthChanged(function(NewHealth) if NewHealth == 0 then game.Workspace.p.Text = "Montanaontario2392 is no longer a GlowLight!" wait (4) game.Workspace.p:remove() game.Lighting.TimeOfDay="1:00:00" end end)
You can look up the HealthChanged event of a Humanoid on the Wiki. |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 08:19 PM |
game.Workspace.montanaontario2392.Humanoid.HealthChanged:connect(function(NewHealth)
I had a typo and forgot the :connect. Apologies. |
|
|
| Report Abuse |
|
|
| |
|