#Why does the IntermissionTimer just randomly keep switching to Loading Map and other shenanigans?

1 messages · Page 1 of 1 (latest)

frail quail
#

it just keeps switching for no reason

#
--client
ChosenMaps.OnClientEvent:Connect(function(MapChosen, Map1,g,TiedMapTable, Number)
    if MapChosen=="vValue" then
        IntermissionLabel.Text = Map1.Name .. " has been chosen."
    elseif MapChosen=="TiedMap" then
        IntermissionLabel.Text = TiedMapTable[Number] .. " has been chosen."
    elseif MapChosen=="gValue" then
        IntermissionLabel.Text = g.Name .. " has been chosen."
    end
    task.spawn(function()
        task.wait(3)
        IntermissionLabel.Text = "Loading..."
        task.wait(3)
        ChosenMaps:FireServer("ClearMapValues")
    end)
end)
--server
local maxIntermissionTime=30
local IntermissionTime=maxIntermissionTime
task.spawn(function()
    while task.wait(1) do
        if IntermissionTime<0 then
            game.ReplicatedStorage.InGame:WaitForChild("Intermission").Value=false
            IntermissionTime=maxIntermissionTime
            game.ReplicatedStorage.InGame.Intermission.IntermissionTimer.Value=IntermissionTime
            game.ReplicatedStorage.Remotes.Intermission:FireAllClients(game.ReplicatedStorage.InGame:WaitForChild("Intermission").Value)
        elseif IntermissionTime>=0 and game.ReplicatedStorage.InGame:WaitForChild("Intermission").Value==true then
            game.ReplicatedStorage.Remotes.Intermission:FireAllClients(game.ReplicatedStorage.InGame:WaitForChild("Intermission").Value)
            game.ReplicatedStorage.InGame.Intermission.IntermissionTimer.Value=IntermissionTime
            IntermissionTime-=1
            print(IntermissionTime)
        end
    end
end)

#
--client again
Intermission.OnClientEvent:Connect(function(IntermissionDB)
    if IntermissionDB==false then
        IntermissionLabel.Text="Choosing map..."
        importances.ChooseMapAutomatically(IntermissionLabel,GameTimer,VotingFrame,PlayerFrame,StartFrame,BackgroundFrame)
    elseif IntermissionDB==true then
        IntermissionLabel.Text="Intermission: " .. IntermissionTimer.Value
    end
end)
#

the problem happens after the game timer ends and intermission restarts

frail quail
#

the amount of repeats is the amount of times it ran

#

in a loop

frail quail
#

NEVERMIND just had to add one line of code

#

"break"

ruby flume
#

Why not use Promise?

frail quail
ruby flume
#

Promises a module

#

Search about and it is very handy for Round System

frail quail
#

i dont know how it work

#

works