Hello, I am making some Nitro Booster perks for my Roblox game, however I don’t know how to check whether someone has a role in my Discord server or not. I have heard of the RoVer API, however I have no idea how to detect whether someone has a specific role. Just so you know, I also have experience with the discord.js library in-case I have to do anything involved with JavaScript.
Please respond to this post if you know anything about how to do this or you have anything to say about it. Thanks a lot.
Odds are you will have to use a discord bot to do this.
The easiest option would be just to hire a bot developer well versed in the discord to roblox connection but if you want to do it yourself you would need to learn JavaScript and the discord API
You could check when someone nitro boosts and just ask for their username. Then just add them to an array like this:
local nitroBoosts = {"TheWorstOne_2"} -- cool dude
function checkIfBooster(player)
for _,user in pairs(nitroBoosts) do
if player.UserId == game:GetService("Players"):GetUserIdFromNameAsync(user) then
return true
end
end
return false
end
game:GetService("Players").PlayerAdded:Connect(function(player)
local boosted = checkIfBooster(player)
if boosted then
--continue
end
end)
When they change their username it should still work since we get the userid and check it from that, instead of the username.
Since Discord by default gives Nitro boosters an irrevocable role called “Nitro Booster”.
Now here is the tricky part. You would need some way to link a Roblox account to a Discord account. You COULD ask for their tag + discriminator in a GUI but you run the risk of getting moderated since there is no way to guarantee a <13 won’t see it. RoVer wouldn’t be helpful unfortunately because it is a Roblox-to-Discord verifier, not the other way around.
You could however use a Roblox group and have your members join that group, and if they are a nitro booster in your server you can use a ranking bot that way.
Another thing you could do instead is to use a trello to keep track of users. The Trello API is pretty simple once you get the hang of it and this would mean you could change users without having to open studio and edit an array
I was originally going to write a large tutorial - then realised how much of a spoonfeed it’d be, so I decided against it.
I’m also not sure if this is allowed on Roblox so bare that in mind!
You’ll need some basic knowledge of a coding language and the Discord API. There’s packages for almost any language - .NET, node.js, Python, Lua (Discordia), etc
You will likely need to set up a verification system so you can send Roblox usernames back and forth instead of Discord usernames which might not be the same.
The documentation of your language of choice will explain how to see if a user has a role - you can use HTTP listeners & requests to do this. HTTP listeners should be used on the non-Roblox-server (obviously, Roblox games don’t have official ways of listening for requests), and the requests should be done on the Roblox server.
The listener would loop through a guild’s members and check if they have the role (again look at the API docs for your chosen language to see how) then return some JSON to the Roblox server (look at HTTP documentation for your chosen language)
On the Roblox-side you can use:
local httpService = game:GetService("HttpService")
local success,data = pcall(function()
return httpService:GetAsync("https://example.com")
end)
if success and data then
data = httpService:JSONDecode(data)
print(data) -- this will likely be a table so you'd need to loop through
end
You should cache the data then compare it on PlayerAdded if you’re using something like Gltch (or anything else that can run out of requests easily) due to limits - this means users who boost who join on an older server won’t get perks till they join a newer server however that existed since they boosted. You can re-request data every so often I suppose if you wanted to.
Once again: I don’t know if Roblox allow this as I believe there was a rule against paying real money for in-game perks, and Nitro/Nitro Boosts both cost money. I’m not certain if this is still a thing or not, however.