Hello there,
I have a small problem with my badge giver script which gives you a badge when you click it. Everything looks fine, but it doesn't give you any badge when you click it. I'm pretty sure the badge ID is correct (my friends also tried it too) and I get no errors in the output. Where did I do wrong?
Here's the script:
local badgeID = [theBadgeID] local badgeService = game:GetService("BadgeService") script.Parent.ClickDetector.MouseClick:Connect(function(playerWhoClicked) if playerWhoClicked.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(playerWhoClicked.Parent) badgeService:AwardBadge(plr.UserId,badgeID) end end)
have you tryed putting the badge id in
i can only think of 1 way im not sure if it works
badgeservice:AwardBadge(plr.UserId,id)
tell me if this works or not
Ok guys so, I made small changes in my script with some help from the tutorials. It works pretty well now, so I fixed my own problem myself. The new script looks like that:
local badgeId = 2124745538 local badgeServ = game:GetService("BadgeService") local clickDetector = script.Parent.ClickDetector clickDetector.MouseClick:Connect(function(plr) badgeServ:AwardBadge(plr.UserId, badgeId) end) clickDetector.Parent = script.Parent