Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this command not working? Can someone help me solve this? This is a countdown command.

Asked by
Vxyrion 23
6 years ago
Edited 6 years ago

This is in a local script:

game.Players.LocalPlayer.Chatted:connect(function(msg)
    local player = game.Players.LocalPlayer
    local rank = :GetRankInGroup(2714283)
    if rank >= 1 then   

if msg == ":Countdown" or msg == ":countdown" or msg == ":cd" or msg == "CD" then
for i = 5,0,-1 do
    wait(1)
    script.Parent.Text = "Countdown: "..i
    if script.Parent.Text == "Countdown: 0" then
        script.Parent.Text = "Times Up!"
        wait(5)
        script.Parent:Destroy()
    end
end

This is in StarterGUI. Followed with a ScreenGUI. Then a textlabel. Then a LocalScript.

3 answers

Log in to vote
0
Answered by 6 years ago

This should fix your problem. You had multiple syntax errors which caused it not to function.

game.Players.LocalPlayer.Chatted:connect(function(msg)
    local player = game.Players.LocalPlayer
    local rank = player:GetRankInGroup(2714283) -- You forgot player here.
    if rank >= 1 then   
        if msg == ":Countdown" or msg == ":countdown" or msg == ":cd" or msg == "CD" then
            for i = 5,0,-1 do
                wait(1)
                script.Parent.Text = "Countdown: "..i
                if script.Parent.Text == "Countdown: 0" then
                    script.Parent.Text = "Times Up!"
                    wait(5)
                    script.Parent:Destroy()
                end -- So
            end -- Many ends
        end -- I forgot to
    end -- Count how many I added
end) -- Sorry

0
Thank you every much! Vxyrion 23 — 6y
Ad
Log in to vote
0
Answered by
xAtom_ik 574 Moderation Voter
6 years ago
Edited 6 years ago

You forgot an end after your function. lots of ends, sorry.

game.Players.LocalPlayer.Chatted:connect(function(msg)
    local player = game.Players.LocalPlayer
    local rank = player:GetRankInGroup(2714283)
    if rank >= 1 then   
--if msg == ":Countdown" or msg == ":countdown" or msg == ":cd" or msg == "CD" then
    for i = 5,0,-1 do
        wait(1)
        script.Parent.Text = "Countdown: "..i
        if script.Parent.Text == "Countdown: 0" then
            script.Parent.Text = "Times Up!"
            wait(5)
            script.Parent:Destroy()
        end
    end
    end
end

It's not the best but it's a try.

0
Hmm...That didn't work for some reason.... Vxyrion 23 — 6y
Log in to vote
0
Answered by
Wiscript 622 Moderation Voter
6 years ago

Here ya go I made an extremely complex script which has loads of designs and looks great. Test it out. If you like it, accept my answer. It works and has been tested.

db = false
game.Players.PlayerAdded:connect(function(p)
    p.Chatted:connect(function(m)
        if db == false then
            if p:GetRankInGroup(2714283) >= 1 then
                if m:lower() == ":countdown" then
                    local Countdown = Instance.new("ScreenGui")
                    local Title = Instance.new("TextLabel")
                    local Shadowing = Instance.new("TextLabel")

                    -- Properties

                    Countdown.Name = "Countdown"
                    for i,v in pairs(game.Players:GetPlayers()) do
                        Countdown.Parent = v.PlayerGui
                    end


                    Title.Name = "Title"
                    Title.Parent = Countdown
                    Title.BackgroundColor3 = Color3.new(1, 1, 1)
                    Title.BackgroundTransparency = 1
                    Title.Position = UDim2.new(0.370000005, 0, 0.170000002, 0)
                    Title.Selectable = true
                    Title.Size = UDim2.new(0.270000011, 0, 0.119999997, 0)
                    Title.ZIndex = 2
                    Title.Font = Enum.Font.SourceSansBold
                    Title.FontSize = Enum.FontSize.Size14
                    Title.Text = "Countdown: "
                    Title.TextColor3 = Color3.new(1, 1, 1)
                    Title.TextScaled = true
                    Title.TextSize = 14
                    Title.TextStrokeTransparency = 0
                    Title.TextWrapped = true

                    Shadowing.Name = "Shadowing"
                    Shadowing.Parent = Title
                    Shadowing.BackgroundColor3 = Color3.new(1, 1, 1)
                    Shadowing.BackgroundTransparency = 1
                    Shadowing.Position = UDim2.new(0.00800000038, 0, 0.0199999996, 0)
                    Shadowing.Size = UDim2.new(1, 0, 1, 0)
                    Shadowing.Font = Enum.Font.SourceSansBold
                    Shadowing.FontSize = Enum.FontSize.Size14
                    Shadowing.Text = "Countdown: "
                    Shadowing.TextColor3 = Color3.new(0.247059, 0.247059, 0.247059)
                    Shadowing.TextScaled = true
                    Shadowing.TextSize = 14
                    Shadowing.TextStrokeTransparency = 0
                    Shadowing.TextWrapped = true
                    for i = 5,0,-1 do
                        Title.Text = "Countdown: "..i
                        Shadowing.Text = "Countdown: "..i
                        wait(1)
                    end
                    Countdown:Destroy()
                    db = true
            end
        end
    end)
end)

Answer this question