|
| 03 Aug 2015 03:45 AM |
ocal wantplay = {} repeat wait() for i, v in pairs(game.Players:GetPlayers()) do if v.PlayerStats then if v.PlayerStats.ingame.Value == true then table.insert(wantplay, v) end end end break until nil local sherrif = wantplay[math.random(1, #wantplay)] local murderer = wantplay[math.random(1, #wantplay)] while sherrif.Name == murderer.Name do wait() local sherrif = wantplay[math.random(1, #wantplay)] end local chosen1 = game.Players:FindFirstChild(murderer.Name) local chosen2 = game.Players:FindFirstChild(sherrif.Name) chosen1.PlayerStats.murderer.Value = true chosen2.PlayerStats.sherrif.Value = true
table.remove(wantplay)
explain why it works the FIRST time but gives up the 3nd time! |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 03:46 AM |
| (BTW there is a local on the top line, i just forgot to paste it) (That is replaceing ocal, its local not ocal in the code) |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 07:14 AM |
local wantplay = {} wait() for i, v in pairs(game.Players:GetPlayers()) do if v.PlayerStats and v.PlayerStats.ingame.Value then table.insert(wantplay, v) end end local sherrif,murderer = wantplay[math.random(#wantplay)],nil repeat murderer = wantplay[math.random(#wantplay)] until murderer~=sherrif murderer.PlayerStats.murderer.Value = true sherrif.PlayerStats.sherrif.Value = true |
|
|
| Report Abuse |
|
|