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: how do u make a function that works when a player dies

Previous Thread :: Next Thread 
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
05 Jul 2013 09:51 AM
function -- what is it?
game.Players.LocalPlayer.TeamColor = BrickColor.new("White")


Report Abuse
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
05 Jul 2013 09:52 AM
bump?
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
05 Jul 2013 09:53 AM
It's a method of the humanoid; Died.
Report Abuse
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
05 Jul 2013 09:54 AM
uhh idk what that is
i started scripting 3 days ago qq
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
05 Jul 2013 09:57 AM
http://wiki.roblox.com/index.php/Died_(Event)

Yes, it's an event, not a method. My bad.
Report Abuse
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
05 Jul 2013 09:57 AM
:c 23 views and 3 replies
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
05 Jul 2013 10:07 AM
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
while not c:FindFirstChild("Humanoid") do wait() end
c.Humanoid.Died:connect(function()

-- Do whatcha want here.

end)
end)
end)
Report Abuse
OKevinO is online. OKevinO
Joined: 05 May 2010
Total Posts: 1036
05 Jul 2013 11:09 AM
player = game.Players.LocalPlayer.Character

while true do wait()
hum = player:findFirstChild("Humanoid")
if hum ~= nil then
if hum.Health == 0 then
--do stuff here
end
end

a while true do loop will work just as fine as a function, except it is more simple to do i guess?

♫~DUBSTEP ]V[AY RULE THE WORLD~♫
Report Abuse
OKevinO is online. OKevinO
Joined: 05 May 2010
Total Posts: 1036
05 Jul 2013 11:09 AM
player = game.Players.LocalPlayer.Character

while true do wait()
hum = player:findFirstChild("Humanoid")
if hum ~= nil then
if hum.Health == 0 then
--do stuff here
end
end
end

forgot to add another end!! my bad!
♫~DUBSTEP ]V[AY RULE THE WORLD~♫
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
05 Jul 2013 12:37 PM
[Local Script inside the player]

script.Parent.Died:connect(function()
--stuff here
end

dunno>yolo
Report Abuse
btft is not online. btft
Joined: 19 Feb 2011
Total Posts: 1512
05 Jul 2013 12:44 PM
:O LOL
--localscript in the player
player=game:service'Players'.LocalPlayer
char = player.Character
repeat wait() until player and char
char.Died:connect(function()
print'dead deal'
end)
Report Abuse
btft is not online. btft
Joined: 19 Feb 2011
Total Posts: 1512
05 Jul 2013 12:45 PM
:O LOL Sorry, forgot a bit.
--localscript in the player
player=game:service'Players'.LocalPlayer
char = player.Character
repeat wait() until player and char
char:WaitForChild("Humanoid").Died:connect(function()
print'dead deal'
end)
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