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

How you add codes to a Tycoon game?

Asked by 6 years ago

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

0
What do you mean? Be more specific. You mean like making a part with words on it? CaptaiinNoob 52 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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.

0
Tysm T-T now my problem is finally solved JennyGaming1 2 — 6y
0
No problem, sorry that the comments glitched out, I could hardly read what I typed myself... cmgtotalyawesome 1418 — 6y
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. cmgtotalyawesome 1418 — 6y
0
use the value instead of indexing the table with the index value User#23365 30 — 5y
0
its there for a reason User#23365 30 — 5y
Ad

Answer this question