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

Why is this Code GUI not working? [closed]

Asked by 9 years ago

So I'm trying to make a code GUI where it will give you the correct amount of money if you guess a certain code, and messages if you already used that code/guessed the wrong one.

It doesn't work, and I have no idea why. Output wasn't helpful. Can someone please help me?

Here's the script:

local plr = script.Parent.Parent.Parent.Parent.Parent
local stats = plr:WaitForChild("leaderstats")
local currency = stats:WaitForChild("Money")
local tag = plr:WaitForChild("CodeTag")
local amount = 10000
local codeval = "Hello"
local code = script.Parent.Parent.Code

function clickOk()
    if code.Text == codeval and tag.Value == false then
        code.Text = "Success!"
        currency.Value = currency.Value + amount
        tag.Value= true
    elseif tag.Value == true  and code.Text == codeval then
        code.Text = "Already Used!"
    elseif code.Text ~= codeval then
        code.Text = "Try Again!"
        end
    end

script.Parent.MouseButton1Click:connect(clickOk)

(Everything is defined)

0
just tell use the output EzraNehemiah_TF2 3552 — 9y
0
Output didn't give me anything CoolJohnnyboy 121 — 9y
0
Nevermind, it's fixed now. CoolJohnnyboy 121 — 9y

Locked by NotsoPenguin and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?