What do you want to achieve? Giving a badge with the proxmity prompt
What is the issue? The badge script I’m using give the badge to everyone on the server and I only want it to give to the player who activates it
Script (Found in the toolbox) :
ID = 2129488332
game.Players.PlayerAdded:connect(function(plr)
script.Parent.Triggered:Connect(function()
b = game:GetService("BadgeService")
b:AwardBadge(plr.userId,ID)
end)
end)
What solutions have you tried so far? I tried to found a YouTube tutorial but I didn’t found
Put this script in ServerScript.
ID = 2129488332
local BadgeService = game:GetService("BadgeService")
script.Parent.Triggered:Connect(function(plr)
if plr then
if not BadgeService:UserHasBadgeAsync(plrr.UserId, ID) then
BadgeService:AwardBadge(plr.UserId, ID)
end
end
end)
You made a mistake on ,
Lucatacos2213:
(plr.userId,ID)
Its supposed to be a Capital UserId (U)
Ggblocks20
(HomelessGuy)
December 24, 2022, 1:04pm
#3
The game.Players.PlayerAdded
function is unneeded, as the .Triggered
event fires a player argument.
Try this code:
ID = 2129488332
b = game:GetService("BadgeService")
script.Parent.Triggered:Connect(function(plr)
b:AwardBadge(plr.UserId,ID)
end)
1 Like
Its better to do local b = game:GetService("BadgeService")
than leave it as a scope
1 Like
system
(system)
Closed
January 7, 2023, 5:50pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.