Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you check if player has reedemed a code?

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.

5 comments

0

Please set this in a real script by clicking the Lua icon.'

0

It is hard to read please put it in Code block :D

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.

0

Have you tried opening output to check if something was working?

0

I posted the code block

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.