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

How do you make a badge reward when you reach like 2500 Strength?

I was wondering how you make a badge reward the person when they reach 2500 strength.

1 answer

To award the badge, you can use the AwardBadge function of BadgeService.

Do this in a Changed event on the player's Strength stat, with an if statement to determine if they have 2500 strength.

In a Script:

local badges = game:GetService("BadgeService")
local badge = 000000 --Your badge
local wantedVal = 2500 --Amount to earn badge

game.Players.PlayerAdded:Connect(function(plr)
	local value = plr:WaitForChild("Strength") --The stat
	value.Changed:Connect(function(val)
		--Don't check if they already own it
		if badges:UserHadBadge(plr.UserId,badge) then return end
		if val >= wantedVal then --Compare the val
			badges:AwardBadge(plr.UserId,badge) --Award the badge
		end
	end)
end)

1 comment

0

It doesn't work

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