generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Easy Script Help

Previous Thread :: Next Thread 
xxnowhereman is not online. xxnowhereman
Joined: 01 Apr 2013
Total Posts: 16
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
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
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
FrozenSmite is not online. FrozenSmite
Joined: 17 Jul 2013
Total Posts: 2242
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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
22 Sep 2013 02:53 AM
>Two threads about the same thing
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image