So, I’ve made a script that detects when the dialog gets activated but I’m not sure how to get the player who activated it, does anyone know how to help me? Thanks.
local badgeService = game:GetService("BadgeService")
local id = 2125440653
script.Parent:GetPropertyChangedSignal('InUse'):Connect(function()
if not script.Parent.InUse then return end
badgeService:AwardBadge(plr.UserId, id) -- Need player for here
end)
local badges = game:GetService("BadgeService")
local userHasBadgeAsync = badges.UserHasBadgeAsync
local awardBadge = badges.AwardBadge
local badgeId = 0 --Change to ID of badge.
local dialog = script.Parent
dialog:GetPropertyChangedSignal("InUse"):Connect(function()
for _, player in ipairs(dialog:GetCurrentPlayers()) do
local success, result = pcall(userHasBadgeAsync, badges, player.UserId, badgeId)
if success then
if not result then
local success, result = pcall(awardBadge, badges, player.UserId, badgeId)
if success then
if result then
print("Badge awarded!")
end
else
warn(result)
end
end
else
warn(result)
end
end
end)