Answered by
6 years ago Edited 6 years ago
You have extra ends here and there and also never really actually ended your while
loop as well.
For future reference, to fix these sort of problems, begin by pasting it in a new file and start indenting on every new scope you have. You just need to be patience of this kinds of things.
Here is your fixed code. Of course since you know the script better than anybody else, you might have to change here and there. I indented it and fixed it through my general understanding of your code.
But do please double check.
002 | Status.Value = "Waiting for enough players" |
004 | repeat wait() until game.Players.NumPlayers > = 2 |
006 | Status.Value = "Intermisson" |
011 | for i, player in pairs (game.Players:GetPlayers()) do |
013 | table.insert(plrs,player) |
018 | local AvailableMaps = MapsFolder:GetChildren() |
019 | local ChosenMap = AvailableMaps [ math.random( 1 ,#AvailableMaps) ] |
020 | Status.Value = ChosenMap.Name.. " Chosen" |
022 | local ClonedMap = ChosenMap:Clone() |
023 | ClonedMap.Parent = workspace |
025 | local SpawnPoints = ClonedMap:FindFirstChild( "SpawnPoints" ) |
027 | if not SpawnPoints then |
028 | print ( "Spawnpoints not found!" ) |
031 | local AvailableSpawnPoints = SpawnPoints:GetChildren() |
033 | for i, player in pairs (plrs) do |
035 | character = player.Character |
037 | character:FindFirstChild( "HumanoidRootPart" ).CFrame = AvailableSpawnPoints [ 1 ] .CFrame |
038 | table.remove(AvailableSpawnPoints, 1 ) |
039 | local Sword = ServerStorage.Sword:Clone() |
040 | Sword.Parent = player.Backpack |
049 | Status.Value = "Get ready to play!" |
052 | for i = GameLength, 0 ,- 1 do |
053 | for x, player in pairs (plrs) do |
055 | character = player.Character |
056 | if not character then |
059 | if character:FindFirstChild( "GameTag" ) then |
061 | print (player.Name.. " is still in the game!" ) |
069 | print (player.Name.. " has been removed!" ) |
073 | Status.Value = "There are " ..i.. " seconds remaining, and " ..#plrs.. " players left" |
077 | Status.Value = "The winner is " ..plrs [ 1 ] .Name |
078 | plrs [ 1 ] .leaderstats.Robux.Value = plrs [ 1 ] .leaderstats.Robux.Value + reward |
080 | elseif #plrs = = 0 then |
081 | Status.Value = "Nobody won!" |
084 | Status.Value = "Time up!" |
091 | for i, player in pairs (game.Players:GetPlayers()) do |
092 | character = player.Character |
094 | if not character then |
097 | if character:FindFirstChild( "GameTag" ) then |
098 | character.GameTag:Destroy() |
101 | if player.Backpack:FindFirstChild( "Sword" ) then |
102 | player.Backpack.Sword:Destroy() |
105 | if character:FindFirstChild( "Sword" ) then |
106 | character.Sword:Destroy() |
111 | player:LoadCharacter() |
115 | Status.Value = "Game ended" |