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 |
|
|
|
| 15 Feb 2013 02:30 AM |
http://wiki.roblox.com/index.php/Died http://wiki.roblox.com/index.php/Destroy_(Method)
|
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 15 Jul 2010 |
| Total Posts: 56 |
|
| |
|
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
|
  |
| Joined: 15 Jul 2010 |
| Total Posts: 56 |
|
|
| 15 Feb 2013 07:21 AM |
| Cool, but how could I disable resetting altogether? |
|
|
| Report Abuse |
|
|
AshJack
|
  |
| Joined: 15 Jul 2010 |
| Total Posts: 56 |
|
| |
|