|
| 20 Apr 2013 06:38 PM |
This is supposed to set the last person alive as the "Winners" value. (The 'Winner' is an ObjectValue). But nothing happens.
People = {}
for i,v in pairs(game.Players:GetChildren()) do table.insert(People,v) while wait(1) do v.Character.Humanoid.Died:connect(function() table.remove(People,v) end) end end
wait(1)
while wait(.5) do if #People < 2 then if People[1] then script.Parent.Winner.Value = People[1] end end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Apr 2013 06:49 PM |
People = {}
for i,v in pairs(game.Players:GetChildren()) do table.insert(People,v) while wait(1) do v.Character.Humanoid.Died:connect(function() table.remove(People,v) end) end end
wait(1)
while wait(.5) do if #People == 1 then script.Parent.Winner.Value = #People end end
try that |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 06:52 PM |
@Master
But that would set the value of 'Winner' to the NUMBER of People. Not the actual person... :c |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 06:53 PM |
People = {}
for i,v in pairs(game.Players:GetChildren()) do table.insert(People,v) while wait(1) do v.Character.Humanoid.Died:connect(function() table.remove(People,v) end) end end
wait(1)
while wait(.5) do if #People == 1 then script.Parent.Winner.Value = People[1].Name end end |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 07:03 PM |
| I need the actual person, not the name. I'll just remove the '.Name' part. Lol |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 07:04 PM |
| You can't make a person a value... |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 07:05 PM |
Both the key and value can be any Lua value (numbers, strings, Parts etc., and even other tables)
|MassiveGman| Scripter & part time Professional Whistler |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 07:06 PM |
Oh, you literally mean a value.
You could use the Name.
Oh wait..
Erm. Nevermind.
|MassiveGman| Scripter & part time Professional Whistler |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 20 Apr 2013 07:50 PM |
| He said it was an ObjectValue. It's just like the 'creator' value that is the foundation of the leaderboard. |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 08:05 PM |
Yes, you can have a player as a value. That's what the "ObjectValue" is for...
I've done it before... |
|
|
| Report Abuse |
|
|