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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Little help...

Previous Thread :: Next Thread 
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
06 Aug 2012 08:07 AM
Right, i have 500 lines of script wrote, all working, now, all i need is, when it awards money, it only awards it if a value called 'Alive' is true, anyway, what i need is, if the player dies, it sets this value to false, so the game knows not to give this player money, im not very familiar with the player died function, so help please, thanks :)

all i need is the script, that changes the value to false if the player dies, ty :)
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
06 Aug 2012 08:09 AM
From wiki:

game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) for _, child in next, character:GetChildren() do if child:IsA('Humanoid') then child.Died:connect(function() Alive = false end) end end end)end)
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
06 Aug 2012 08:10 AM
thankyou dude :)
i must say, your pretty helpfull :)
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
06 Aug 2012 08:11 AM
use the event Died in the humanoid in the player

example:
PlayerName = ""--the name on the player here
game.Players[PlayerName].Character.Humanoid.Died:connect(function()
--Stuffs to do
end)
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
06 Aug 2012 08:11 AM
A better structure:


game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
for _, child in next, character:GetChildren() do
if child:IsA('Humanoid') then
child.Died:connect(function()
Alive = false
end)
end
end
end)
end)
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
06 Aug 2012 08:11 AM
ops, I was too late to post.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
06 Aug 2012 08:12 AM
And your script isn't that good because it works for one specific person.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
06 Aug 2012 08:13 AM
I know, it was only an example.
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
06 Aug 2012 08:18 AM
Thankyou people for the help :) just testing if it workies now >:P
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
06 Aug 2012 08:20 AM
why does alive.value not change to false when the character dies? Or does it only work in online mode?
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
06 Aug 2012 08:21 AM
Oh, is alive a BoolValue? So an object inside anywhere? Like the Player? If so, you got to change the path.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
06 Aug 2012 08:22 AM
did you spell it "alive.value" or did you spell it "Alive.Value", lua is case-sensitive?
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
06 Aug 2012 08:23 AM
For example if it would be inside Player (not recommended):


game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
for _, child in next, character:GetChildren() do
if child:IsA('Humanoid') then
child.Died:connect(function()
player:findFirstChild("Alive").Value = false --You just gotta get the right path here, then
end)
end
end
end)
end)


I also hope it isn't a local value.
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
06 Aug 2012 08:30 AM
huh?
When player entered,
it gets given a BoolValue called Alive,
Alive.Value is true when entered,
But if the player dies then it gets changed to false
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