Here is the script.

NumPlayers = 1 Minigames = game.ServerStorage.Minigames:GetChildren()

function Meg(Text) print(Text) end

function PlayerAdded(Player) local Bool = Instance.new("BoolValue", Player) Bool.Name = "AFK"

local leaderstats = Instance.new("IntValue", Player)
leaderstats.Name = "leaderstats"
local Points = Instance.new("IntValue", leaderstats)
Points.Name = "Points"

end

function GetPlayers() local Players = () for i,v, in pairs (game.Players.GetChildren()) do if v:FindFirstChild ("AFK") and not v.AFK.Value then table.insert(Players, v) end end return Players end

game.Players.PlayerAdded:Connect(PlayerAdded)

while true do local Players = GetPlayers() if #Players() >= NumPlayers then Meg("Enough players have joined! Let the games begin!") wait(3) Meg("Choosing a minigame...") local Chosen = Minigames [math.random(1, #Minigames)] local Clone = Chosen:Clone() wait(2) Meg("Minigame Chosen! The minigame will be " .. Chosen.Name .. " Minigame ") Clone.Parent = workspace.CurrentMinigame Meg("Teleporting...") for i,v in pairs (Players) do if v then local Teleport = Clone.Teleports:GetChildren() [math.random(1, #Clone.Teleport:GetChildren())] v.Character:SetPrimaryPartCFrame(Teleport.CFrame.new(0, 5, 0)) Teleport:Destroy() end end else Meg("I know this SUCKS, but we can't start, There are not enough players... :(")

end wait() end

3 comments

0

please wrap everything within the codebox, and can you also specify on which line the error occured?

0

oh my

0

You should use the :GetService("ServerStorage") option rather than game.ServerStorage