|
| 22 Sep 2013 12:14 AM |
Completely new to Lua scripting, but have some experience in scripting elsewhere.
Anyhow, I'm trying to figure out how to script (obvs) and I can't figure out how to do this. Basically, when my players hp reaches 0, I just want it to print "asdf" in the output. I know this is probably not even close to what you need to write, but this is what I have. It's very simple and to the point.
1: local H = Workspace.xxnowhereman.Humanoid.Health 2:(Don't know what goes here) 3:print ("I like bananas") 4:end
Between lines 1 and 3 are my problem. I want something along the lines of.. when (or if) H = 0 then print 'asdf' end
How do I do this? Please be thorough and thank you for any assistance. |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 12:21 AM |
Visit the wiki for tutorials and introductions. They are fundamentally convenient as a beginner.
Also, I have had trouble in the past with attributing variables directly to object values, so tag it a branch early. This is the proper if statement:
if Humanoid.Health == 0 then
You can print("asdf") here, and make sure you end every if statement. |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 12:54 AM |
function X_X() -- The grouping of a script that will be activated if game.Workspace.xxnowhereman.Humanoid.Health <= 0 then -- If ur hp is less than or equal to 0 then print("ZOMG!!! HES DEAD!! AHHHH!!!") -- Printing a msg end end game.Workspace.xxnowhereman.Humanoid.Changed:connect(X_X) -- activating the function when your hp gets changed ♫♪ repeat wait() until game.Players.FrozenSmite.HasALife == true ♪♫ |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 02:53 AM |
| >Two threads about the same thing |
|
|
| Report Abuse |
|
|