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

WHY DOESN'T THIS WORK?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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 
0
Its a little messed up beacuse the way it made it but... NateDawgGamingRoHD 5 — 8y
0
This snippet doesn't help us determine why the game doesn't start when people join BlackJPI 2658 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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

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! NateDawgGamingRoHD 5 — 8y
0
And btw when i get rid of the halftime script it works its just the game won't start because something is wrong! NateDawgGamingRoHD 5 — 8y
Ad

Answer this question