data["discordUsers"] is what we are looking for. For your problem, we can simply check the length of it since we only need to know if anyone is authorized under that account.
if #data["discordUsers"] > 0 then
print("authorized")
else
print("not authorized")
end
To check if the code is working, input USER_ID as 1. It should print “not authorized”.
Thanks for spending almost half an our helping me, much love.
How can I check if a player has a certain role? theres a property in discordusers under the value 1 named [“roles”] and each role has a id marked under a number value order
Yeah, it’s the discord role ID.
In discord settings, enable Developer Mode (in App Settings → Advanced).
Go in your server settings, find the role you will need to check for, and click those 3 dots. There will be a button to copy role ID.
table.find(data["discordUsers"]["roles"], ROLE ID).
Will return nil if the role is not found, returns ROLE ID index if found.
Basically check table.find(data["discordUsers"]["roles"], ROLE ID) ~= nil.
Kay then it doesnt work because it doesnt find the role.
I put the role id as a developer role which is my role.
I added a attribute which goes to true if i have that role and it just stays on false with no error