#Why does the IntermissionTimer just randomly keep switching to Loading Map and other shenanigans?
1 messages · Page 1 of 1 (latest)
--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
Why not use Promise?
use what