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

WHY DOESN'T THIS WORK?

This code isn't working in my football game. Im making it so after the 2nd quarter theres halftime for 60 seconds. Why won't this work? When two people join the game doesn't start!

``

--Halftime

if quarter==2 and
workspace.Clock.Value> 0 then
message("Halftime",3);
game.Workspace.music.Song1:Play()
wait(60)
quarter=quarter+1;
workspace.Quarter.Value=numDisp(quarter);
setup(false,true);
Ready=true;
Kickoff=true;

end	

2 comments

0

Its a little messed up beacuse the way it made it but...

0

This snippet doesn't help us determine why the game doesn't start when people join

1 answer

The snippet you provided us with doesn't let us know what's wrong. If you want a game to start when two people join you'll need something like this:

function checkPlayers()
	return game.Players.NumPlayers > = 2	 --If there are two or more people return true
end


function startGame()						--This is where your game stuff is
	--Game stuff here--
end


game.Players.PlayerAdded:connect(function()
	if checkPlayers() then				--If checkPlayers() is true start the game
		startGame()
	end
end)

If you have any further questions feel free to ask

2 comments

0

Its a whole master script though. I just wan't it to have a halftime. The master script is over 900 lines. I just want to add a halftime!

0

And btw when i get rid of the halftime script it works its just the game won't start because something is wrong!

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