Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make it so when you press a GUI button with leaderboard stats, you get badge?

Asked by
Txymar -3
6 years ago

I've been designing a GUI so that when a person has enough points on the leaderboard he can go into the shop GUI and click the 'buy badge' button that will then award him the badge if they have enough leaderboard points.

1
This is a helping website, not a request website. Jxemes 75 — 6y
0
If you are specific on what exactly you want to know how to do {give badge, save date, clicking a gui ) we can help. Bellyrium 310 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
local badgeID = 000000 -- replace this with the badge's ID
local badgeService = game:GetService("BadgeService")

-- you can get the player yourself

script.Parent.MouseButton1Click:Connect(function() -- assuming the script is in the button
    if player.Data.Points.Value >= 1000 then
        badgeService:AwardBadge(player.userId, badgeID)
    end
end)

that should work, if not, oh well, i typed it here. you can look on the wiki and fix it yourself.

0
is that supposed to be a localscript or a script somewhere? Txymar -3 — 6y
0
inside the button, if you want to get the player easier, localscript. RobloxianDestory 262 — 6y
Ad

Answer this question