Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a badge that when you reach that amount of strength?

I was wondering how you make a badge that, when you reach the amount of strength that is needed. You are awarded that badge.

2 answers

local player = game.Players.LocalPlayer
local strength = player.LeaderStats.Strength
local badge = "ID HERE"
local BService = game:GetService("BadgeService")

function AwardBadge(userid, badge)
	if not BService:UserHadBadge(userid, badge) then
	end
end

strength.Value.Changed:Connect(function()
	if strength.Value >= 100 then
	AwardBadge(player.userid, badge)
	end
end)

Maybe? Hopefully it works. I don't know :|

2 comments

0

Sadly, it didn't work

0

aaahhhhhhh

Replace

function AwardBadge(userid, badge)
if not BService:UserHadBadge(userid, badge) then
end
end

With

if strength >= 100 then
local badgeID = 12312321 -- replace this with the badge's ID
local badgeService = game:GetService("BadgeService")
	badgeService:AwardBadge(player.userId, badgeID)
end

Get back to me on ROBLOX https://web.roblox.com/messages/compose?recipientId=167367445

Or go read the ROBLOX wiki about badges http://wiki.roblox.com/index.php?title=Badge if something goes wrong (I read the wiki to get all my knowledge)

This discussion is preserved as it was. New answers, comments, and votes are closed.