jbjgang2
|
  |
| Joined: 07 Feb 2010 |
| Total Posts: 8948 |
|
|
| 11 Jan 2015 01:21 PM |
local suspects = PossibleVictims[math.random(1,#PossibleVictims)]
PossibleVictims is an array of 5 random plyers
Swaggin' Since Twenty Ten |
|
|
| Report Abuse |
|
|
jbjgang2
|
  |
| Joined: 07 Feb 2010 |
| Total Posts: 8948 |
|
|
| 11 Jan 2015 01:22 PM |
I fixed it nvm changed 1 to 0
Swaggin' Since Twenty Ten |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Jan 2015 01:32 PM |
That's going to b a problem, it'll be nil since PossibleVictims[0] is most likely nil (unless you set it to something directly).
The problem is that when that part of the script runs, PossibleVictims contains nothing. |
|
|
| Report Abuse |
|
|
jbjgang2
|
  |
| Joined: 07 Feb 2010 |
| Total Posts: 8948 |
|
|
| 11 Jan 2015 01:41 PM |
but when I change 0 back to 1, the script doesnt work again
Swaggin' Since Twenty Ten |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Jan 2015 01:45 PM |
'The problem is that when that part of the script runs, PossibleVictims contains nothing.'
You might think it contains 5, but it doesn't (or at least not in the sense that the key starts at 1 and ascends to 5+) |
|
|
| Report Abuse |
|
|
jbjgang2
|
  |
| Joined: 07 Feb 2010 |
| Total Posts: 8948 |
|
|
| 11 Jan 2015 01:46 PM |
Spaces = 5 local name = Names[math.random(1,#Names)] local suspects = PossibleVictims[math.random(0,#PossibleVictims)] nametext.Text = name table.remove(Names, Names[name]) if player ~= witch then if Spaces >= 1 then table.insert(PossibleVictims, Names[name]) Spaces = Spaces - 1 end end if player == witch then if Spaces >= 1 then Spaces = Spaces - 1 table.insert(PossibleVictims, Names[name]) else table.remove(PossibleVictims, PossibleVictims[suspects]) table.insert(PossibleVictims, Names[name]) end end end
Swaggin' Since Twenty Ten |
|
|
| Report Abuse |
|
|