I changed line 18 from local players = game.Players to local players = Region3.Players and now im getting a ServerScriptService.mini game script:18: attempt to index nil with 'GetChildren' error
local status = game.ReplicatedStorage.status
local maps = game.ReplicatedStorage.maps:GetChildren()
while true do
for i = 1,3
do
status.Value = "Intermisson:"..3-i
wait(1)
end
local rand = math.random(1, #maps)
local map = maps [rand]:Clone()
map.Parent = workspace
status.Value = "we'll be playing "..map.Name
wait(3)
local players = Region3.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
local spawnlocation = math.random(1,#workspace.Teleports:GetChildren())
players[i].Character:MoveTo(workspace.Teleports:GetChildren()[spawnlocation].Position)
players[i].Character.Parent = workspace.ingame
end
end
local roundlength = 50
local canwin = true
if map:FindFirstChild("obby") then
map.endpart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
canwin = true
status.value = hit.Parent.name.."he's won"
end
end)
end
repeat
roundlength = roundlength -1
status.Value = "time left:"..roundlength
wait(1)
until roundlength == 0 or canwin == false or #workspace.ingame:GetChildren()==0
wait(1)
map: destroy()
local players = game.Players:GetChildren()
for i = 1, #players do
if players[i].Character ~= nil then
players[i]:LoadCharacter()
end
end
end
