Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why the error? Please tweak the script so it works and the error goes away :)

Asked by
OFF_S4LE 127
4 years ago

im trying to make a intermission script and a ingame script so when there are only 1 player in the alive team the game goes back to intermission.

error it GetPlayers: : Expected 'then' when parsing if statement, got 'GetPlayers'

Script thats in worKSPAce:

local seconds = game.Workspace.Time
local Game = game.Workspace.Game.Position


while true do

 wait(1)
 seconds.Value = seconds.Value - 1
if teams.Alive GetPlayers == 1 then

 local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i].Character:MoveTo(Vector3.new(Game.X, Game.Y, Game.Z))

end
end
local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i]:LoadCharacter()

end
end



1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

On line 9 you forgot to put a . so it should be:

local seconds = game.Workspace.Time
local Game = game.Workspace.Game.Position


while true do

 wait(1)
 seconds.Value = seconds.Value - 1
if teams.Alive.GetPlayers == 1 then

 local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i].Character:MoveTo(Vector3.new(Game.X, Game.Y, Game.Z))

end
end
local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i]:LoadCharacter()

end
end

1
Also instead of workspace I would put your script in ServerScriptService to make your game more secure. Master_Aaron 59 — 4y
0
what a sad mistake OFF_S4LE 127 — 4y
1
Haha, don't worry you're good. Just make sure you check over your work before posting it on here, this should be your last plan if everything else fails. Master_Aaron 59 — 4y
Ad

Answer this question