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

I have a timer that starts over for a new player joining the game! How do I fix this?

Asked by
vra000 22
3 years ago

I have a working minigame with a working timer that starts from: "A minigame will be chosen in 15 seconds", but, when a new player joins the game, the gui for THAT player starts over from 15 seconds.

Here is my code:

local part = workspace.start
local nice = workspace.grass

while true do
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 15 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 14 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 13 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 12 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 11 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 10 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 9 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 8 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 7 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 6 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 5 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 4 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 3 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 2 seconds"
    wait(1)
    script.Parent.Text = "A minigame will be chosen in 1 second"
    wait(1)
    script.Parent.ImageLabel.Visible = true
    wait(1)
    script.Parent.Text = "The round will begin in 14 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 13 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 12 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 11 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 10 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 9 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 8 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 7 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 6 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 5 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 4 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 3 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 2 seconds"
    wait(1)
    script.Parent.Text = "The round will begin in 1 second"
    wait(1)
    script.Parent.Text = "The round is beginning!"
    wait(1)
    for _,player in pairs(game:GetService("Players"):GetPlayers())do
        if player and player.Character then
            player.Character:MoveTo(part.Position)
        end
    end
    wait(0.1)
    script.Parent.ImageLabel.Visible = false
    wait(1)
    script.Parent.Text = "00:30"
    wait(1)
    script.Parent.Text = "00:29"
    wait(1)
    script.Parent.Text = "00:28"
    wait(1)
    script.Parent.Text = "00:27"
    wait(1)
    script.Parent.Text = "00:26"
    wait(1)
    script.Parent.Text = "00:25"
    wait(1)
    script.Parent.Text = "00:24"
    wait(1)
    script.Parent.Text = "00:23"
    wait(1)
    script.Parent.Text = "00:22"
    wait(1)
    script.Parent.Text = "00:21"
    wait(1)
    script.Parent.Text = "00:20"
    wait(1)
    script.Parent.Text = "00:19"
    wait(1)
    script.Parent.Text = "00:18"
    wait(1)
    script.Parent.Text = "00:17"
    wait(1)
    script.Parent.Text = "00:16"
    wait(1)
    script.Parent.Text = "00:15"
    wait(1)
    script.Parent.Text = "00:14"
    wait(1)
    script.Parent.Text = "00:13"
    wait(1)
    script.Parent.Text = "00:12"
    wait(1)
    script.Parent.Text = "00:11"
    wait(1)
    script.Parent.Text = "00:10"
    wait(1)
    script.Parent.Text = "00:09"
    wait(1)
    script.Parent.Text = "00:08"
    wait(1)
    script.Parent.Text = "00:07"
    wait(1)
    script.Parent.Text = "00:06"
    wait(1)
    script.Parent.Text = "00:05"
    wait(1)
    script.Parent.Text = "00:04"
    wait(1)
    script.Parent.Text = "00:03"
    wait(1)
    script.Parent.Text = "00:02"
    wait(1)
    script.Parent.Text = "00:01"
    wait(1)
    script.Parent.Text = "00:00"
    wait(1)
    for _,player in pairs(game:GetService("Players"):GetPlayers())do
        if player and player.Character then
            player.Character.Humanoid.Health = 0
        end
    end
   wait(1)  
   script.Parent.Text = "A minigame will be chosen in 15 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 14 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 13 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 12 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 11 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 10 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 9 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 8 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 7 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 6 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 5 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 4 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 3 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 2 seconds"
wait(1)
script.Parent.Text = "A minigame will be chosen in 1 second"
wait(1)
script.Parent.OtherImageLabel.Visible = true
wait(1)
script.Parent.Text = "The round will begin in 14 seconds"
wait(1)
script.Parent.Text = "The round will begin in 13 seconds"
wait(1)
script.Parent.Text = "The round will begin in 12 seconds"
wait(1)
script.Parent.Text = "The round will begin in 11 seconds"
wait(1)
script.Parent.Text = "The round will begin in 10 seconds"
wait(1)
script.Parent.Text = "The round will begin in 9 seconds"
wait(1)
script.Parent.Text = "The round will begin in 8 seconds"
wait(1)
script.Parent.Text = "The round will begin in 7 seconds"
wait(1)
script.Parent.Text = "The round will begin in 6 seconds"
wait(1)
script.Parent.Text = "The round will begin in 5 seconds"
wait(1)
script.Parent.Text = "The round will begin in 4 seconds"
wait(1)
script.Parent.Text = "The round will begin in 3 seconds"
wait(1)
script.Parent.Text = "The round will begin in 2 seconds"
wait(1)
script.Parent.Text = "The round will begin in 1 second"
wait(1)
script.Parent.Text = "The round is beginning!"
    wait(1)
    game.ReplicatedStorage.ClassicSword:Clone().Parent = game.StarterPack
    wait(1)
    for _,player in pairs(game:GetService("Players"):GetPlayers())do
        if player and player.Character then
            player.Character.Humanoid.Health = 0
        end
    end
    wait(5)
for _,player in pairs(game:GetService("Players"):GetPlayers())do
    if player and player.Character then
        player.Character:MoveTo(nice.Position)
    end
    end
    wait(2)
    end

I have tried setting ResetOnSpawn on False, but it still didn't work. I am making this game for Christmas, so my friends can compete to see who can get the robux gift card from me. Please Help! (nike is the start of the first minigame, and nice is the start of the second minigame.)

Answer this question