I’m trying to make a countdown script it works fine but when another account joins the script duplicates and the countdown subtracts by 2 instead of 1
The script is in ServerScriptService
wait(5) ---Wait Until The Server Starts
while true do
wait(0.25)
script.Count.Value = 60 --- 60
for i = 1,50 do --- 50
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Frame.Visible = true
script.Count.Value -= 1
pgui.BossCountdown.Frame.TextLabel.Text = "Boss In: " .. script.Count.Value .. " Seconds"
end
end
for i = 1,10 do
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Frame.Visible = true
script.Count.Value -= 1
ss.Countdown:Play()
pgui.BossCountdown.Frame.TextLabel.Text = "Boss In: " .. script.Count.Value .. " Seconds"
end
end
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.Boss.Frame.Enabled.Value = true
end
script.Count.Value = 180 --- 180
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Frame.Visible = true
pgui.BossCountdown.Frame.TextLabel.Text = "Boss Is Starting!"
end
wait(0.05)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Enter.Visible = true
end
wait(6.5)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Enter.Visible = false
end
for i = 1,170 do --- i = 1,170
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Frame.Visible = true
script.Count.Value -= 1
pgui.BossCountdown.Frame.TextLabel.Text = "Boss Ending In: " .. script.Count.Value .. " Seconds"
end
end
for i = 1,10 do
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Frame.Visible = true
script.Count.Value -= 1
ss.Countdown:Play()
pgui.BossCountdown.Frame.TextLabel.Text = "Boss Ending In: " .. script.Count.Value .. " Seconds"
end
end
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.Boss.Frame.Enabled.Value = false
end
script.Count.Value = 30 --- 30
for i = 1,20 do --- 20
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Frame.Visible = true
script.Count.Value -= 1
pgui.BossCountdown.Frame.TextLabel.Text = "Intermission: " .. script.Count.Value
end
end
for i = 1,10 do
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local pgui = v:WaitForChild("PlayerGui")
pgui.BossCountdown.Frame.Visible = true
script.Count.Value -= 1
ss.Countdown:Play()
pgui.BossCountdown.Frame.TextLabel.Text = "Intermission: " .. script.Count.Value
end
end
end
I also have another error that I’m trying to make a player system it looks like this
Everything works when im playing solo but when another player joins it my player doesn’t show up and when im trying to control the other player it says this in the output
also on my main my player sometimes doesn’t show up