Basic Usage
This guide will walk you through the basic setup and usage of the discord-verify SDK.
Verify a Player
To verify if a player is in your Discord server, use verify.verify().
You should have a player click a “Verify” button to verify if they have joined the discord server. This makes any reward feel earned, increasing player engagement.
Note
After a player verifies, make sure to save it to their player data to not need to require an additional http request next time the player joins the game.
local isVerified = verify.verify(player)
if isVerified then
print(player.DisplayName .. " is in the Discord server!")
else
print(player.DisplayName .. " is NOT in the Discord server! :(")
endPolicy Service (Required)
To comply with Roblox’s policies, you must use PolicyService before showing players any UI related to Discord, including a verification button. This service determines if a player can view off-platform links based on factors like their age and region. You can read more at the Roblox Creator Documentation.
local PolicyService = game:GetService("PolicyService")
local success, result = pcall(function()
return PolicyService:GetPolicyInfoForPlayerAsync(player)
end)
if success == true then
local allowedLinks = result.AllowedExternalLinkReferences
local isDiscordAllowed = table.find(allowedLinks, "Discord") ~= nil
if isDiscordAllowed then
print(player.DisplayName .. " is allowed to view verification menu")
else
print(player.DisplayName .. " is NOT allowed to view verification menu")
end
endHandle Successful Verification (Optional)
The verify.verified signal fires when a player successfully verifies. You can use this signal for any post verification needs, like saving the verification state to the player’s data.
verify.verified:Connect(function(player: Player)
print(player.DisplayName .. " successfully verified!")
end)Analytics
For tracking your verification funnel, call openedMenuEvent when a player opens the verification menu.
-- Call this when the player opens the verification UI
verify.openedMenuEvent(player)