|
| 28 Jun 2015 02:54 PM |
How to randomly select a child? I want it to randomly select a spawn then I make the NPC MoveTo it. This is a respawn script.
|
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
|
| 28 Jun 2015 02:57 PM |
assuming they all have the same name
local allspawns = {} local plr = NPC b = game.Workspace:GetChildren() for i = 1,#b do wait() if b[i]:IsA("SpawnLocation") then table.insert(allspawns,b[i]) end end
if #allspawns >= 1 then newspawn = allspawns(math.random[1,#allspawns]) print("Selected spawn") end
-Baheeg |
|
|
| Report Abuse |
|
|
|
| 28 Jun 2015 03:13 PM |
I need it to randomly select a child and their Vector3 value. Not their double. |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
|
| 28 Jun 2015 03:21 PM |
Just process their Vector3 value?
-Baheeg |
|
|
| Report Abuse |
|
|