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

Why the error? Please tweak the script so theres no error and it works :)

This is a script in ServerScriptService seconds is the defined version of my intvalue "time" The error in if game.Workspace.seconds.Value "0" = true then is the "=" it has a red line and it says "ServerScriptService.Script:10: Expected 'then' when parsing if statement, got '='" when i hover over it this is supposed to be a intermission and it starts the game ten when there is 1 player in the alive team it restarts the game.

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


while true do
 
 wait(1)
	 seconds.Value = seconds.Value - 1
	if game.Workspace.seconds.Value "0" = true 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
	if teams.Alive.GetPlayers == 1 then
local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i]:LoadCharacter()

end
end



I put as much info as i could, please help

just comment if you need more info :)

2 answers

✓ Accepted answer

You're comparing two values so you need to do "==" just like how you did it on line 16.

if game.Workspace.seconds.Value == 0 then

Also on line 16, I'm not really sure what's going on, but I'm assuming you're trying to see how many children are inside of that model? You would need to use GetChildren and then a # to get the amount of values in the array.

if #teams.Alive:GetChildren() == 1 then

1 comment

0

im trying to see how much players are on the 'alive" team

Try:

local Teams = game:GetService("Teams")
local Seconds = workspace.Seconds
local GamePlace = workspace.Game.Position
local Players = game:GetService("Players")

while true do
	wait(1)
	Seconds.Value = Seconds.Value - 1
	if Seconds.Value == "0" then
		for Index, Player in pairs(Players:GetChildren()) do
			Player.Character.HumanoidRootPart.CFrame = CFrame.new(GamePlace.X, GamePlace.Y, GamePlace.Z)
		end
	end
	if #Teams.Alive:GetPlayers() == 1 then
		for Index, Player in pairs(Players:GetChildren()) do
			Player:LoadCharacter()
		end
	end
end

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