I made a script to spawn to the mini game for round base game and the script is not running?
here is my script i put it inside serverscriptserviece and i dont know whats wrong
Numplayers = 1
Minigames = game.ServerStorage.Minigames : getChildren ()
function msg (text)
print (text)
end
01 | function PlayerAdded(Player) |
02 | local Bool = Instance.new ( "BoolValue" , Player) |
08 | for i,v in pairs (game.Players:GetChildren()) do |
09 | if v:FindFirstChild ( "AFK" ) and not v .AFK.Value then |
10 | table.insert(Players, v) |
15 | game.Players.PlayerAdded:connect(PlayerAdded) |
19 | local Players = GetPlayers() |
20 | if #Players() > = Numplayers then |
21 | Msg ( "There are not enough players, to start the game!" ) |
23 | Msg ( "Choosing a map..." ) |
25 | local chosen = Minigames [ math.random ] ( 1 , #Minigames( ] |
26 | local Clone = Chosen = Chosen:Clone() |
28 | Msg ( "Minigame chosen! The map is " ... chosen.Name..) |
29 | Clone.Parent = workspace.CurrentMinigame |
30 | Msg ( "Teleporting players to the minigame." ) |
31 | for i,v in pairs (Player) do |
33 | local Teleport = Clone.Teleports:GetChildren () [ math.random( 1 , #Clone.Teleports:GetChildren)() ] |
34 | v.Charcter:SetPrimaryPartCFrame(Teleport.CFrame * CFrame.new ( 0 , 5 , 0 )) |
39 | Msg ( "There are not enough players to start the game!" ) |