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: Kick on death

Previous Thread :: Next Thread 
AshJack is not online. AshJack
Joined: 15 Jul 2010
Total Posts: 56
15 Feb 2013 02:25 AM
I am planning a game about life in general, and I would like it so when you die, be it of old age, car crash, illness or something else, that you are kicked from the game, because when you die in real life, you don't come back (assuming defibulators didn't work)

So how would I write this script?

AshJack.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
15 Feb 2013 02:30 AM
http://wiki.roblox.com/index.php/Died
http://wiki.roblox.com/index.php/Destroy_(Method)
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
15 Feb 2013 02:31 AM
1) Put a value inside the Player called 'Death'
2) Make a script that checks each value if the value has been changed (Event : .Changed:connect())
3) Kick the Player if that value is true, for example.

Change the value to true, if the Player has been killed or is a very high age, etc
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
15 Feb 2013 02:33 AM
Eww. Just use events.
Report Abuse
AshJack is not online. AshJack
Joined: 15 Jul 2010
Total Posts: 56
15 Feb 2013 03:00 AM
How would I put the two scripts together?
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
15 Feb 2013 04:11 AM
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
if p then
c.Humanoid.Died:connect(function(death)
print(p.Name.."'s has been kicked from the server")
p:Destroy()
end)
end
end)
end)
Report Abuse
AshJack is not online. AshJack
Joined: 15 Jul 2010
Total Posts: 56
15 Feb 2013 04:40 AM
Thanks!
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
15 Feb 2013 05:17 AM
My solution is better because of the next :
1) If a Player reset's he won't be kicked
2) You have more control when the Player will be Kicked.

Game:GetService("Players").PlayerAdded:connect(function(new)
Life = Instance.new("BoolValue")
Life.Parent = new
Life.Name = "Life"
Life.Value = true
Life.Changed:connect(function()
if Life.Value == false then
PlayerObject = Life.Parent
PlayerObject:Destroy()
end
end)
end)

Now you change the Value if a Player died with the follow code
Game:GetService("Players").velibor.Life.Value = false
Report Abuse
AshJack is not online. AshJack
Joined: 15 Jul 2010
Total Posts: 56
15 Feb 2013 07:21 AM
Cool, but how could I disable resetting altogether?
Report Abuse
AshJack is not online. AshJack
Joined: 15 Jul 2010
Total Posts: 56
06 Mar 2013 01:08 PM
bump
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