local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local countdownNegation = 1
player.Chatted:Connect(function(msg)
local splitmessage = msg:split(" ")
if splitmessage[1] == ":cd" or ":countdown" and splitmessage[2] == "%d" then
local CDGUI = Instance.new("ScreenGui")
local Frame1 = Instance.new("Frame")
local CDnumber = Instance.new("TextLabel")
local CDValue = Instance.new("NumberValue")
local CDName = Instance.new("TextLabel")
local Frame2 = Instance.new("Frame")
CDGUI.Name = "CDGUI"
CDGUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
for _, players in pairs(game.Players:GetPlayers()) do
CDGUI.Parent = players.PlayerGui
end
Frame1.Name = "Frame1"
Frame1.Parent = CDGUI
Frame1.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
Frame1.BackgroundTransparency = 0.100
Frame1.BorderColor3 = Color3.fromRGB(255, 255, 255)
Frame1.BorderSizePixel = 3
Frame1.Position = UDim2.new(0.008688787, 0, 0.811352253, 0)
Frame1.Size = UDim2.new(0.150078982, 0, 0.176961601, 0)
CDnumber.Name = "CDnumber"
CDnumber.Parent = Frame1
CDnumber.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CDnumber.BackgroundTransparency = 1.000
CDnumber.Position = UDim2.new(0.121052638, 0, 0.264150947, 0)
CDnumber.Size = UDim2.new(0.75, 0, 0.469452888, 0)
CDnumber.Font = Enum.Font.GothamSemibold
CDnumber.Text = "COUNTDOWN"
CDnumber.TextColor3 = Color3.fromRGB(255, 255, 255)
CDnumber.TextScaled = true
CDnumber.TextSize = 14.000
CDnumber.TextWrapped = true
CDValue.Parent = CDGUI
CDName.Name = "CDName"
CDName.Parent = Frame1
CDName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CDName.BackgroundTransparency = 1.000
CDName.Position = UDim2.new(0.0263157915, 0, 0, 0)
CDName.Size = UDim2.new(0.947368264, 0, 0.0920945257, 0)
CDName.Font = Enum.Font.GothamBold
CDName.Text = "COUNTDOWN"
CDName.TextColor3 = Color3.fromRGB(255, 255, 255)
CDName.TextScaled = true
CDName.TextSize = 14.000
CDName.TextWrapped = true
Frame2.Name = "Frame2"
Frame2.Parent = Frame1
Frame2.BackgroundColor3 = Color3.fromRGB(42, 42, 42)
Frame2.BackgroundTransparency = 0.100
Frame2.BorderColor3 = Color3.fromRGB(255, 255, 255)
Frame2.BorderSizePixel = 3
Frame2.Size = UDim2.new(0.99999994, 0, 0.0920870528, 0)
CDValue.Value = splitmessage[2]
CDnumber.Text = CDValue.Value
while true do
wait(1)
CDnumber.Text = CDValue.Value - countdownNegation
end
end
end)
Hi there,
I don’t really understand the title, do you mean that the countdown is stopping when the timer ends? If yes, it is intentional.
No just ou put “:cd 3” It do 3,2 and then stops.
Alright, I have a feeling that your timer ends on the number “1” instead of “0”, try to edit that if you can.
No, literraly i put :CD and only change 1 number.
Gotcha, so essentially your script isn’t correctly changing the values, let may show you how to fix it.
Replace with:
while true do
wait(1)
if CDValue.Value >= 0 then
CDValue.Value = CDValue.Value - countdownNegation
CDnumber.Text = CDValue.Value
else
break
end
end
I haven’t tested it & it’s not the most practical but it should do the job.
Yes now it go but it stay at -1 and dont dissapear.
Code it so it deletes the UI after we say “else”, make sure to put all the code you need to delete it before the “break”.
Can somebody help me fix this?
while true do
wait(1)
if CDValue.Value >= 0 then
CDValue.Value = CDValue.Value - countdownNegation
CDnumber.Text = CDValue.Value
else
break
end
if CDnumber == "0" then
Frame1.Visible = false
end
end
So close, this should do the trick:
while true do
wait(1)
if CDValue.Value > 0 then
CDValue.Value = CDValue.Value - countdownNegation
CDnumber.Text = CDValue.Value
else
CDGUI:Destroy()
break
end
end
If this worked for you make sure to mark as solution!
And also, if i want add “if plr:IsInGroup() then” I add it here?
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local countdownNegation = 1
local plr = game:GetService("Players").LocalPlayer
if plr:IsInGroup(1234) then
player.Chatted:Connect(function(msg)
local splitmessage = msg:split(" ")
if splitmessage[1] == ":cd" or ":countdown" and splitmessage[2] == "%d" then
Is that good?
No, take a look at this post on how to understand a bit more about handling ranks.
Is not the solution.
you can use but you dont see yours the first person that join the cd go for he but the next dont go for he.
I don’t quite understand, could you re-word that for me?
This worked just fine for me when I tested it.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.