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

how to do I restart a script when a round is over?

Asked by
zValerian 108
5 years ago
Edited 5 years ago

so I've been working on a game that has rounds and intermission. What I am trying to do is that when round ends, it fires intermission and then it starts again. Here is the script I want to fire when the intermission is over.

function update(count)
    local player = game.Players.LocalPlayer
    game.Players.LocalPlayer.PlayerGui.pods.ann.TextButton.Text = "Waiting for "..count.." more players!"
    if count <= 0  and game.Workspace.game.CanCollide == true then
        game.Players.LocalPlayer.PlayerGui.pods.ann.Visible = true
        game.Players.LocalPlayer.PlayerGui.pods.ann.TextButton.Text = "Welcome to the annual HUNGER GAMES"
        wait(10)
        game.Players.LocalPlayer.PlayerGui.pods.ann.TextButton.Text = "If you don't know how to play, read the description!"
        wait(10)
        player.TeamColor = BrickColor.new("Forest green")
        game.Players.LocalPlayer.PlayerGui.pods.ann.TextButton.Text = "Selecting random arena..."
        wait(5)
        game.Players.LocalPlayer.PlayerGui.pods.ann.TextButton.Text = "Arena selected. Prepare to enter the game. May the odds be ever in your favor."
        wait(20)
        game.Players.LocalPlayer.PlayerGui.pods.ann.Visible = false
        local Pos = player.Character:GetPrimaryPartCFrame()
                    player:LoadCharacter()
                    player.Character:SetPrimaryPartCFrame(Pos)
                    if player.Character:FindFirstChild("ForceField") then
                        player.Character["ForceField"]:Destroy()
                        wait(1)
                        game.ReplicatedStorage.Remotes.tp:FireServer()
game.Workspace.game.CanCollide = false
                    end
    end
    end

game.ReplicatedStorage.Notify.OnClientEvent:connect(update)


here is the script that I want to fire the script above.

local player = game.Players.LocalPlayer
game.Players.LocalPlayer.PlayerGui.pods.ann.Visible = true
game.Players.LocalPlayer.PlayerGui.pods.ann.TextButton.Text = "Intermission.."
wait(30)
game.Players.LocalPlayer.PlayerGui.pods.ann.Visible = false
game.Workspace.game.CanCollide = true
local Pos = player.Character:GetPrimaryPartCFrame()
                    player:LoadCharacter()
                    player.Character:SetPrimaryPartCFrame(Pos)
                    if player.Character:FindFirstChild("ForceField") then
                        player.Character["ForceField"]:Destroy()
                game.Workspace.inter.CanCollide = false
                game.ReplicatedStorage.Remotes.start:FireServer()
                    end


Do any of you have any ideas? I am lost. Any help will be appreciated.

0
You seem to want to restart the 'round' after it ends, right? Try fitting this all into a while loop on a Server Script since the server should be handling game stuff. xPolarium 1388 — 5y
0
do you have any advice on how to do this? zValerian 108 — 5y

Answer this question