Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

3 comments

1

Also instead of workspace I would put your script in ServerScriptService to make your game more secure.

0

what a sad mistake

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.