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

Help on my auto game?

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.

2 comments

0

Please Edit your question, then hit the "Code block" button, then put the script code inside of that so we can read it.

0

Sorry fixed it

1 answer

✓ Accepted answer

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.

2 comments

0

http://hastebin.com/isiwiveten.lua Please replace your code with this.

0

It didn't work

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