I have a error on a script in serverscriptservice that I need help fixing, how would I?
I was writing a script for my game and I got an error, I'm not sure how I would fix it, as far as I can tell everything is right. Here's the script.
001 | local MapsFolder = ServerStorage:WaitForChild( "Maps" ) |
003 | local Status = ReplicatedStorage:WaitForChild( "Status" ) |
005 | local GameLength = 600 |
012 | Status.Value = ( "Waiting for enough players" ) |
014 | repeat wait( 1 ) until game.Players.NumPlayers > = 2 |
016 | Status.Value = ( "Intermission" ) |
022 | for i, player in pairs (game.Players:GetPlayers()) do |
024 | table.insert(plrs,player) |
030 | local AvailableMaps = MapsFolder:GetChildren() |
032 | local ChosenMap = AvailableMaps [ math.random( 1 ,#AvailableMaps) ] |
034 | Status.Value = ChosenMap.Name.. " Chosen" |
036 | local ClonedMap = ChosenMap:Clone() |
037 | ClonedMap.Parent = workspace |
039 | local SpawnPoints = ClonedMap:FindFirstChild( "SpawnPoints" ) |
041 | if not SpawnPoints then |
042 | print ( "SpawnPoints not found!!! You big dummy!!!" ) |
045 | local AvailableSpawnPoints = SpawnPoints:GetChildren() |
047 | for i, player in pairs (plrs) do |
049 | character = player.Character |
053 | character:FindFirstChild( "HumainoidRootPart" ).CFrame = AvailableSpawnPoints [ 1 ] .CFrame |
054 | table.remove(AvailableSpawnPoints, 1 ) |
056 | local GameTag = Instance.new( "BoolValue" ) |
057 | GameTag.Name = "GameTag" |
058 | GameTag.Parent = player.Character |
069 | Status.Value = "Teleporting" |
073 | for i = GameLength, 0 ,- 1 do |
075 | for x, player in pairs (plrs) do |
078 | character = player.Character |
080 | if not character then |
083 | if character:FindFirstChild( "GameTag" ) then |
085 | print (player.Name.. " is still alive" ) |
089 | print (player.Name.. " has been killed" ) |
095 | print (player.Name.. " has been killed" ) |
099 | Status.Value = "Time till Deathmatch " ..i.. " Players remaining " ..#plrs.. |
102 | Status.Value = plrs [ 1 ] .Name.. " wins!!!" |
103 | plrs [ 1 ] .leaderstats.Wins.Value = plrs [ 1 ] .leaderstats.Wins + reward |
105 | elseif #plrs = = 0 then |
106 | Status.Value = "All players have perished " |
109 | Status.Value = "Teleporting to Deathmatch " |
The error is on line 101 with the if, it is underlined and the error says "Expected identifier when parsing expression, got if". Thanks for any help.