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

Help on my auto game?

Asked by
Zelnus 30
8 years ago

So I started making an Automatic game where it needs 5 people to start. This is the script I have:

if game.Players.NumPlayers > 4 then
    script.Parent.Text = "5 Players Needed To Start The Trial"
    wait(2)
        script.Parent.Text = "Trials Will Begin In 10 Seconds"
    game.Workspace.Beep.Sound:Play()
    wait(1)

And so on. So when 5 people come it starts the game and opens the doors and stuff but then if somebody resets it does it all over again. How do I make it so if someone kills their self It doesn't start over again and when 5 people join it starts and then restarts but needs 5 people.

0
Please Edit your question, then hit the "Code block" button, then put the script code inside of that so we can read it. Validark 1580 — 8y
0
Sorry fixed it Zelnus 30 — 8y

1 answer

Log in to vote
1
Answered by
KoreanBBQ 301 Moderation Voter
8 years ago

For minigames type games, I suggest doing something like so:

local minimumNumPlayers=5
local numPlayers=game.Players.NumPlayers
local gameRunning=false
local roundChoices={"minigame1","minigame2","minigame3"

}
local PlayRound = function(round)
local time=180
local tickStartTime=tick()
local minigame=game.ServerStorage[round]:clone()
minigame.Parent=workspace
--or whatever loads your minigame, also load players, give tools, etc. etc.
repeat
local tickCurrentTime=tick() 
time=tonumber(time-(tickCurrentTime-tickStartTime))
--add other cool countdown stuff here, idk
wait()
until
--whatever condition makes your minigame ends, you could put a bool value telling if a player is in or out and that changes when they die, flag captured, etc., whatever
end
while numPlayers>=5 and not gameRunning  do
local round=roundChoices[math.random(1,#roundChoices)]
PlayRound(round)
end

not sure that is perfect or would even work I just wrote that to answer this hope it helped.

But my point is you need to loop it somehow, with a while loop most likely.

0
http://hastebin.com/isiwiveten.lua Please replace your code with this. Validark 1580 — 8y
0
It didn't work Zelnus 30 — 8y
Ad

Answer this question