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)

3 comments
just tell use the output
Output didn't give me anything
Nevermind, it's fixed now.