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

How you add codes to a Tycoon game?

How you add codes to Tycoon game? Like...Twitter codes and stuff...not scripting codes :<

1 comment

0

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

1 answer

✓ Accepted 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

0

Tysm T-T now my problem is finally solved

0

No problem, sorry that the comments glitched out, I could hardly read what I typed myself...

0

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.

0

use the value instead of indexing the table with the index value

0

its there for a reason

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