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

How do you check if player has reedemed a code?

Asked by 7 years ago

Hi, I have tried many attempts to make an twitter code gui. I did make it work, but I wanted to add another feature which is to check if the player has already redeemed the code. I tried countless times and it never worked, I would like someone to explain to me how to do it properly.

Here is the code:

local ifowned = false

script.Parent.MouseButton1Click:connect(function() if script.Parent.Parent.TextBox.Text == "code" then script.Parent.Parent.TextBox.Text = "reedemed!" wait(0.5) script.Parent.Parent.TextBox.Text = "enter code here" ifowned = true else script.Parent.Parent.TextBox.Text = "Invalid code" wait(0.5) script.Parent.Parent.TextBox.Text = "enter code here" if ifowned == true and script.Parent.Parent.TextBox.Text == "code" then script.Parent.Parent.TextBox.Text = "already reedemed" wait(0.5) script.Parent.Parent.TextBox.Text = "enter code here" end end end)

don't mind me if I make spelling mistakes in the script. Sorry I don't know how to use the code block, because I don't know how to use it.

0
Please set this in a real script by clicking the Lua icon.' jtwgames 0 — 7y
0
It is hard to read please put it in Code block :D DumbKickButt5588 167 — 6y
0
You can't do it all in a local script, you must utilize a server-script to save that the player has redeemed the code. ArcticDev 9 — 6y
0
Have you tried opening output to check if something was working? DumbKickButt5588 167 — 6y
0
I posted the code block activatesenju 2 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
local ifowned = false
local tbox = script.Parent.Parent.TextBox

script.Parent.MouseButton1Click:connect(function()
    if tbox.Text == "code" then
        print("reedemed!")
        ifowned = true
    else
        print("invalid code")
        if ifowned == true and tbox.Text == "code" then
            print("you already reedemed code")
        end
    end
end)

here is my code block. I checked everything in the output and works but the redeemed thing is not working. Don't mind the spelling errors in the script.

Ad

Answer this question