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

How do i make another code like from simulators because it underlines elseif? [closed]

Asked by 3 years ago

Hello, im new here so here is a twiiter code script but how do i add another code because it underlines elseif Script:

-- variables
local player = game.Players.LocalPlayer
local event = game.ReplicatedStorage.Code
local code = player:FindFirstChild("Codes")
local codetable = {
    code1 = "Welcome",
    code2 = "Release",
}

-- optional code if you want your codes to expire after a time
local date = os.date("*t", os.time())

script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Parent.Parent.CodeHandle.Text ~= "code1" then
        -- example of a code that can expire
        if script.Parent.Parent.Parent.CodeHandle.Text == codetable.code1 then
            if date["month"] == 10 and date["day"] <= 10 and date["year"] == 2021 then
                -- doing this just to test the expiration of the code!!!
                if not code:FindFirstChild("Code1") then -- these two must be same
                    event:FireServer("Code1", 100) -- cash reward
                    script.Parent.Text = "Code Successfully Redeemed!"
                    script.Parent.Parent.SuccessAudio.Playing = true
                    script.Parent.Parent.CodeHandle.Text = ""
                    wait(2)
                    script.Parent.Text = "Redeem"
                else
                    script.Parent.Text = "Already Readeemed"
                    script.Parent.Parent.CodeHandle.Text = ""
                    wait(2)
                    script.Parent.Text = "Redeem"
                end
            else
                script.Parent.Text = "Code Expired!"
                script.Parent.Parent.ErrorAudio.Playing = true
                script.Parent.Parent.CodeHandle.Text = ""
                wait(2)
                script.Parent.Text = "Redeem"
            end
        elseif script.Parent.Parent.Parent.CodeHandle.Text == codetable.code2 then
            if not code:FindFirstChild("Code2") then
                event:FireServer("Code2", 100)
                script.Parent.Text = "Code Successfully Redeemed!"
                script.Parent.Visible = false
                script.Parent.Parent.Redeem2 = true
                script.Parent.Parent.SuccessAudio.Playing = true
                script.Parent.Parent.CodeHandle.Text = ""
                wait(2)
                script.Parent.Text = "Redeem"
            else
                script.Parent.Text = "Already Redeemed"
                script.Parent.Parent.CodeHandle.Text = ""
                wait(2)
                script.Parent.Text = "Redeem"
            end
        else
            script.Parent.Text = "Invalid Code"
            script.Parent.Parent.ErrorAudio.Playing = true
            wait(2)
            script.Parent.Text = "Redeem"
        end
    else
        script.Parent.Text = "Enter Code"
        wait(2)
        script.Parent.Text = "Redeem"
`   `end
end)
0
Could you please explain it a bit better, i am not quite sure what do you mean, errors in output? what color is underline? imKirda 4491 — 3y

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?