drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
|
| 06 Apr 2014 02:06 AM |
This is a minigame script I have, and it each round ends when the time runs out (90 seconds per round). I was wondering if someone could help me with this:
I need the game to end if there is only one player left alive, or if the time runs out. Can someone please help me?
Here is the script:
while true do wait(5) local m = math.random(1,1) local player = game.Players:GetPlayers() for i = 1, #player do msg = Instance.new("Hint") msg.Parent = nil if m == 1 then msg.Parent = game.Workspace msg.Text = "Choosing Map." wait(1) msg.Text = "Choosing Map.." wait(1) msg.Text = "Choosing Map..." wait(1) msg.Text = "A Map has been chosen!" wait(3) msg.Text = "The Map is..." wait(3) msg.Text = "Raft" wait(2) msg.Text = "Survive the Round!" wait(5) msg.Text = "The game will be starting in:" wait(1) msg.Text = "...3..." wait(1) msg.Text = "..2.." wait(1) msg.Text = ".1." wait(1) msg.Text = "Begin!" wait(1) for i,v in pairs(game.Players:GetPlayers()) do local x = { [1] = Vector3.new(416,110.4,-162); [2] = Vector3.new(426,110.4,-162); [3] = Vector3.new(421,110.4,-162) } v.Character:MoveTo(x[math.random(1,#x)]) end msg:remove() game.Lighting.Field1:clone().Parent = game.Workspace wait(90) msg.Parent = game.Workspace msg.Text = "Winner(s)!" wait(3) msg:remove() game.Workspace.Field1:Remove() msg.Parent = game.Workspace msg.Text = "Intermission" wait(20) msg:remove() end end end |
|
|
| Report Abuse |
|
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
| |
|
Vexeris
|
  |
| Joined: 03 Apr 2014 |
| Total Posts: 468 |
|
|
| 06 Apr 2014 11:26 PM |
if Numplayers = 1 then Game.Players:remove() |
|
|
| Report Abuse |
|
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
|
| 06 Apr 2014 11:32 PM |
| Im not quite sure how those lines fit into this??? |
|
|
| Report Abuse |
|
|
Vexeris
|
  |
| Joined: 03 Apr 2014 |
| Total Posts: 468 |
|
|
| 06 Apr 2014 11:33 PM |
fail i fixed it if Numplayers == 1 then Game.Players:remove() end put it at the end of ur script |
|
|
| Report Abuse |
|
|
Vexeris
|
  |
| Joined: 03 Apr 2014 |
| Total Posts: 468 |
|
|
| 06 Apr 2014 11:33 PM |
| no wait put it on another script , Lol |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2014 11:46 PM |
So troll... lol.
Too bad you can't remove the GameService!
Your problem is you have everything needed in that script, but you didn't make it. Please learn how 2 code b 4 posting. |
|
|
| Report Abuse |
|
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
| |
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
| |
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
| |
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 07 Apr 2014 08:27 PM |
| Why is there a for I loop at the top? |
|
|
| Report Abuse |
|
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
|
| 07 Apr 2014 08:45 PM |
| In the entirety of the script I have it is more than that. |
|
|
| Report Abuse |
|
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
| |
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
|
| 08 Apr 2014 01:20 AM |
Bump, I need this minigame script to end a minigame when either one player is left, or if the time runs out.
Can anyone help me? :) |
|
|
| Report Abuse |
|
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
| |
|
|
| 10 Apr 2014 04:09 PM |
A mini-game script would have the following.
The setup A lobby queue wait A game (which checks for players alive/playing) A cleanup
In the setup i would create a table. When the lobby queue switches to the game, insert all player names into the table. Used humanoid.died events to remove them from this table
The game you can handle yourself.
The cleanup you can handle yourself.
Here:
players ={}
function movePlayers() for i, v in pairs(game.Players:getChildren())do players[v.Name] = v.Character end end
function start_game()
end
function clearTable() players = {} end
function cleanup() clearTable() wait(20) start_game() end
|
|
|
| Report Abuse |
|
|