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: If player.health == 0 then

Previous Thread :: Next Thread 
moses747 is not online. moses747
Joined: 24 Jan 2011
Total Posts: 269
21 May 2013 08:39 PM
What would I use for that. Here is my guess:
if game.Workspace.Player.Humanoid.Health == 0 then

Is that right or not. If not then what would I use?
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
21 May 2013 08:40 PM
if game.Workspace.Player.Humanoid.Health <= 1 then

Just in case...

~ The ATR Fishie ~
Report Abuse
moses747 is not online. moses747
Joined: 24 Jan 2011
Total Posts: 269
21 May 2013 08:48 PM
@lord
Nope :l
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
21 May 2013 08:50 PM
lord's would work. Show us the actual script you're using and the output you're getting.
Report Abuse
moses747 is not online. moses747
Joined: 24 Jan 2011
Total Posts: 269
21 May 2013 08:51 PM
local h = Instance.new("Hint", game.Workspace)
wait(.1)
h.Text = "Welcome! Try to esacpe... if you can."
wait(15)
h:remove()

if game.Workspace.Player.Humanoid.Health <= 1 then
wait(.1)
h.Text = "Oh no! You were so close! Try again."
wait(15)
h:remove()
end

That is a Local Script.
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
21 May 2013 08:54 PM
Where is this located? Localscripts don't work in workspace. Your script won't also work as intended to. It'll only check if the a player named "Player" is dead at the exact moment (after 15 secs)
Report Abuse
moses747 is not online. moses747
Joined: 24 Jan 2011
Total Posts: 269
21 May 2013 09:01 PM
Oh, it's in StarterGUI, it works for the first part but not the second part. And how do I put any player in general (any player playing it).
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
21 May 2013 09:05 PM
game.Players.LocalPlayer.Character.Humanoid.Health
Report Abuse
Shapeless is not online. Shapeless
Joined: 18 May 2013
Total Posts: 106
21 May 2013 09:12 PM
Yours is just not practical...


local Players = {}
local SetUp = function()
for _,n in next,Game.Players:GetPlayers() do
table.insert(Players,n)
end
for _,n in next,Players do
if n and n.Character and n.Character:FindFirstChild("Humanoid") then
coroutine.wrap(function()
n.Character.Humanoid.Died:wait()
for __,nn in next,Players do
if nn == n then
table.remove(Players,__)
end
end
end)()
end
end
end

local IS = function(P)
for _,n in next,Players do
if P == n then
return true
end
end
end

local Added = function(Player)
SetUp()
local h = Instance.new("Hint", game.Workspace)
wait(.1)
h.Text = "Welcome! Try to esacpe... if you can."
wait(15)
h:Destroy()
for _,n in next,Game.Players:GetPlayers() do
if IS(n) then
--------------------What to do when they are alive----------
else
---------------What to do when they are dead-------------
end
end
Players = {}
end
Report Abuse
moses747 is not online. moses747
Joined: 24 Jan 2011
Total Posts: 269
21 May 2013 09:12 PM
It didn't work I will show you the script. I will toy around with it though.
Report Abuse
moses747 is not online. moses747
Joined: 24 Jan 2011
Total Posts: 269
21 May 2013 09:13 PM
local h = Instance.new("Hint", game.Workspace)
wait(.1)
h.Text = "Welcome! Try to escape... if you can."
wait(15)
h:remove()

if game.Players.LocalPlayer.Character.Humanoid.Health <= 1 then
wait(.1)
h.Text = "Oh no! You were so close! Try again."
wait(15)
h:remove()
end

Report Abuse
Shapeless is not online. Shapeless
Joined: 18 May 2013
Total Posts: 106
21 May 2013 09:16 PM
Thanks, for ignoring me :).

But in this example you already removed the message. So either re-parent it or don't remove it.

local h = Instance.new("Hint", game.Workspace)
wait(.1)
h.Text = "Welcome! Try to escape... if you can."
wait(15)
h:remove()

if game.Players.LocalPlayer.Character.Humanoid.Health <= 1 then
wait(.1)
h.Text = "Oh no! You were so close! Try again."
h.Parent = Worksapce
wait(15)
h:remove()
end
Report Abuse
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
21 May 2013 09:17 PM
If this is in StarterGUI and everyone is recieving the GUI; can't you simply do:

if script.Parent.Parent.Parent.Character.Humanoid.Health <= 1 then

Assuming it's directly under a ScreenGUI.
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