I was making a countdown script (for a friend), however just a bug. The countdown stops after just subtracting 1 number.
Script:
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)