In this tutorial, I’ll show you how to make a Discord-Roblox codes
To understand this tutorial, you need to know basic scripting, as this will tell how to get codes from Discord-Roblox but not on how to make a codes redeeming Gui
Like, the redeem codes one, you can set-up codes from
This is a simple tutorial, and is not meant for 5+ codes
Proof that this works:
-- 1 = Code
-- 2 = Coins awarded
-- 3 = (Ignore)
-- 4 = can be used many times or not
This is good, if your a newbie scripter, as this works and is not hard
However there are harder ways for doing this system
Step 1
Enable https requests in your game
Step 2
Create a Discord Webhook
Here’s how:
- Click channel settings
2.Click integrations
3.Click new webhook
4.Don’t name it rrrrrrrr like I did, I just did that, we will rename it soon
5.Click copy url
- Rename your webhook
In the following way, 1 is your code, 2 is reward for using code, 3 is just a word, 4 is can it be used many times or not
Step 3
You got your webhook done, now just make a script in Roblox Studio
Script:
local httpsservice = game:GetService("HttpService")
local url = ""
local info = httpsservice:GetAsync(url,false) -- you get the info of your webhook by this
local decodedinfo = httpsservice:JSONDecode(info) -- its a JSON table so we make it Lua table
local codes = {} -- an empty table, we will add the codes in here
local codeinname = string.split(decodedinfo["name"]," ") -- this will cut the name into pieces where you kept space, keep space bar when your entering more codes
Also to enter many codes, keep a space in between just like this:
It will cut the name into pieces where space bar is located, so you can keep 1-5 codes in your webhook
Let’s get back to the script: (its the same script)
local httpsservice = game:GetService("HttpService")
local url = ""
local info = httpsservice:GetAsync(url,false) -- you get the info of your webhook by this
local decodedinfo = httpsservice:JSONDecode(info) -- its a JSON table so we make it Lua table
local codes = {} -- an empty table, we will add the codes in here
local codeinname = string.split(decodedinfo["name"]," ") -- this will cut the name into pieces where you kept space, keep space bar when your entering more codes
for i,v in pairs(codeinname) do -- now we'll loop through all the codes in table, we will run this function below for each code
local splittedvalues = string.split(v,"-") -- this will cut each code we wrote like 1,2,3,4
local codename = splittedvalues[1] now inside the name, we have the name as 1st value
codes[codename] = splittedvalues -- the code name have the following table
end
print(codes) -- it prints the final table of all the codes which you wrote in discord, but came in Roblox
The final printed table:
I have 2 codes, Coins and Coins2
Now using this table, you can make a Redeem UI, and when you update the code in Discord webhook, it will affect all your servers in your game, and its not laggy/fps drop down
Step 4
Tutorial is done, enjoy!
Thanks for reading the tutorial
Any questions DM me,
Any suggestions reply below
Have a nice day