When I try to load in a map and give a tool to all players it gives me this error
my script part:
1 | local players = game.Players:GetChildren() |
2 | for i = 1 ,#players do |
3 | if players [ i ] .Character ~ = nil then |
4 | local spawnLocation = math.random( 1 ,#map.Teleports:GetChildren()) |
5 | players [ i ] .Character:MoveTo(map.Teleports:GetChildren() [ spawnLocation ] .Position) |
6 | players [ i ] .Character.Parent = workspace.InGame |
7 | end |
8 | end |
how do I fix this
My full code:
01 | local status = game.ReplicatedStorage.Status |
02 | local maps = game.ReplicatedStorage.Maps:GetChildren() |
03 |
04 | while true do |
05 | for i = 1 , 10 do |
06 | status.Value = "Intermission " .. 15 -i |
07 | wait( 1 ) |
08 | end |
09 |
10 | local rand = math.random( 1 , #maps) |
11 |
12 | local map = maps [ rand ] :Clone() |
13 | map.Parent = workspace |
14 |
15 | status.Value = "Chosen Minigame: " ..map.Name |