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

How do you make the game announce which team won each round after the game clock expires?

Asked by 7 years ago

Hey, I am making a game and it has 5-minute rounds. The leaderboard tracks something called team kills which is basically the number of kills the entire team got combined. My goal is to make it so that when each round ends, the game will figure out which team has more team kills and announce in a screen GUI who won. I have scripted the clock, leaderboard, weapons, arena, GUIs, and everything else successfully I just need help with the determining who won the game, announcing it after every game, then restarting the round (resets all players). If someone could help me with this that would be really appreciated. Thanks for your time.

Pertinent Details: The two teams are called Red and Blue (This might change later on but those are the names for right now)

This is my working timer script (I do NOT need help with this script, it works, I just thought it might be needed to help with the requested script):

01repeat
02while true do
03    wait(1)
04    if script.Parent.Value == 0 then
05        local map = game.Workspace.LaserArena
06    map:Clone().Parent = game.Workspace
07    wait(5)
08    game.Workspace.LaserArena:Destroy()
09    wait(5)
10        script.Parent.Value = 300
11        script.Parent.Value = script.Parent.Value -1
12    else
13        script.Parent.Value = script.Parent.Value -1
14    end
15end
16until character == nil

A full script would be extremely helpful but help to create one would be just as good. If you have any other questions regarding my question or if you want to see any of my other scripts from the game (like my leaderboard script, etc...), just ask in the comments or message me on Roblox, I will check both often so it probably won't take long for me to respond.

Thank you, Skyraider5

0
xXLegendarySoldierXx Thank you so much, you have been unbelievably helpful, I will try this out, just to clarify though, use that script instead of my original timer script? Thanks again for your help. Skyraider5 -21 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

So, what you'd probably want to do is wrap everything in a while loop instead. Like so:

01local clockTime = 500
02 
03while true do
04    --// Load in your map
05    --// Give weapons, etc.
06    --// Clock stuff
07    for i = clockTime, 1 do
08        wait(1)
09        --// Update Clock GUI
10    end
11    --// Did a for loop so you could easily update a clock GUI if you so wish, if not just make it this instead: wait(clockTime)
12    local Gui = leaderboard --// You didn't say where it was so..
13    local winMessage
14    if leaderboard.Red.TeamKill.Value > leaderboard.Blue.TeamKill.Value then
15        winMessage = "The Red team has won!"
View all 25 lines...

This script should restart itself, and repeat everything all the time. It should work, but maybe not. I just quickly wrote it to give you a rough idea of how it could be done. Instead of having separate scripts, just have one control the main game mechanics like:

Loading in players, setting up the map, giving weapons, then the clock, displaying who won, then resetting the players.

Ad

Answer this question