Could someone help me with this Map Changing script?
Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
So I've been making a Game Engine that just gets the players in the game to spawn in a randomly chosen map. That part finally works. Now I'm trying to figure out a way so that when people die they spawn at the game if the game is still going on. I did attempt by making that SpawnLocation1 in my game Disabled.That was only the first step...
Script Below:
01 | minigames = game.ServerStorage.Minigames:GetChildren() |
03 | h = Instance.new( "Hint" , game.Workspace) |
06 | if game.Players.NumPlayers > 0 then |
07 | h.Text = "Deciding what game to play" |
09 | ranGame = math.random( 1 , #minigames) |
10 | gameChosen = minigames [ ranGame ] |
11 | h.Text = gameChosen.Name |
13 | gameChosenClone = gameChosen:Clone() |
14 | gameChosenClone.Parent = game.Workspace |
16 | spawns = gameChosenClone.Spawns:GetChildren() |
18 | for i,v in pairs (game.Players:GetPlayers()) do |
22 | game.Workspace.SpawnLocation 1. Enabled = false |
23 | check = game.Workspace:FindFirstChild(name) |
26 | checkHumanoid = check:FindFirstChild( "Humanoid" ) |
30 | check:MoveTo(spawns [ i ] .Position) |
34 | h.Text = "Game begins in:" .. i |
41 | h.Text = "Time left: " .. i |
45 | gameChosenClone:Destroy() |
46 | h.Text = "Game ended!" |
48 | game.Workspace.SpawnLocation 1. Enabled = true |
50 | h.Text = "There needs to be one than 1 character to start bro!" |