How you add codes to Tycoon game? Like...Twitter codes and stuff...not scripting codes :<
How you add codes to a Tycoon game?
1 answer
First off you need to add a gui with a textbox on your screen, assuming that you got that, all you need to do is make a text button next to it and add this script into it:
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Text = (whatever you want your code to be for that time) then
--For the rest of this you simply need to give them the rewards that you want.
end
end)
If you had numerous codes at one times your script could also look like this:
--// Variables
Codes = {}
--// Redeeming
script.Parent.MouseButton1Click:connect(function()
for i, v in pairs(Codes) do
if Codes[i] == script.Parent.Text then --[[since i changes to the amount of times we
run, it will start at 1 and keep going, this means we can check each
value in the table, from one to however many we have and see if what they typed is a code.
]]
--For the rest of this you, again, simply need to give them the rewards that you want.
end
end
end)
Hope I helped and please accept my answer if I did.
5 comments
Tysm T-T now my problem is finally solved
No problem, sorry that the comments glitched out, I could hardly read what I typed myself...
I don’t know if you are going to read this but I have made a mistake, :connect is deprecated, you will have to change that to :Connect for it to work in future updates.
use the value instead of indexing the table with the index value
its there for a reason
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
What do you mean? Be more specific. You mean like making a part with words on it?