I want to make an aura system that player will get only access if them got an certain badge. Is there any way to do this?
4 Likes
Look at this page, it has example code:
https://developer.roblox.com/en-us/api-reference/function/BadgeService/UserHasBadgeAsync
1 Like
Incase more clarification is needed here, here is an example of basically making a UI element visible if a user owns a badge:
local BS = game:GetService("BadgeService")
local ID = 1 -- badge id
local Player = game.Players.LocalPlayer
local UI = script.Parent -- path to ui
script.Parent.Visible = BS:UserHasBadgeAsync(Player.UserId, ID) -- this either gives us true or false, we can simply set the visible bool to the results bool
1 Like
local badges = game:GetService("BadgeService")
local userHasBadge = badges.UserHasBadgeAsync
local players = game:GetService("Players")
local player = players.LocalPlayer
local screenGui = script.Parent
local badgeId = 0 --Change to badge's ID.
local success, result = pcall(userHasBadge, badges, player.UserId, badgeId)
if success then
if result then
screenGui.Enabled = result
end
else
warn(result)
end
4 Likes