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
 

Re: Why Is This Not Working?

Previous Thread :: Next Thread 
TexasTech717 is not online. TexasTech717
Joined: 24 Apr 2012
Total Posts: 1129
02 Apr 2014 10:13 PM
I am trying to make a script that when a player dies, a GUI message is shown. There is no output...

player = game.Players.LocalPlayer
playerN = player.Name
i2 = game.Workspace.Info2
Humanoid = player.Character.Humanoid

repeat wait() until player and Humanoid
if Humanoid.Health == 0 then
i2.Value = ""..playerN.." has been defeated!"
script:remove()
end
Report Abuse
TexasTech717 is not online. TexasTech717
Joined: 24 Apr 2012
Total Posts: 1129
02 Apr 2014 10:16 PM
For the information, it is a LocalScript in StarterGui.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
02 Apr 2014 10:25 PM
local player = game.Players.LocalPlayer
local playerN = player.Name
i2 = game.Workspace.Info2
local Humanoid = player.Character:WaitForChild("Humanoid")

repeat wait() until Humanoid ~= nil
if Humanoid.Health == 0 then
i2.Value = ""..playerN.." has been defeated!"
script:remove()
end

Make sure the script is getting into the playergui, backpack, or something.
Report Abuse
TexasTech717 is not online. TexasTech717
Joined: 24 Apr 2012
Total Posts: 1129
02 Apr 2014 10:30 PM
It did not work, and I even put it in the StarterGui to start with!
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
02 Apr 2014 10:32 PM
local player = game.Players.LocalPlayer
local playerN = player.Name
local i2 = game.Workspace.Info2

repeat
wait()
until player.Character
player.Character:WaitForChild("Humanoid").Died:connect(function()
i2.Value = player.Name .. " has been defeated!";
end)
Report Abuse
TexasTech717 is not online. TexasTech717
Joined: 24 Apr 2012
Total Posts: 1129
02 Apr 2014 10:35 PM
Wow, math. Such skill. So works.
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