How to award a badge at the end of this scavenger hunt?

So I’m using this tutorial provided by Roblox: Scavenger Hunt | Roblox Creator Documentation

But I am kinda lost (it seems a little hard for me since I’m a beginner scripter), how do I exactly make it reward a badge after collecting all the tokens for the scavenger hunt? I know it says you can do it in the tutorial but I still don’t understand how? I am unsure where to even add the script for awarding the badge…

(Can someone please help me solve this issue by explaining it very simply so that I can understand?)

1 Like

You would change the code by awarding the badge instead of just the print statement as follows:

ScavengerHunt.allCollected:Connect(function(player)
    BadgeService:AwardBadge(player.UserId, badgeId)
end)

At the top of the script you need to define two things:

local BadgeService = game:GetService("BadgeService")
local badgeId = 00000000 -- Put your created badge id here
1 Like

Would you mind telling me which script it is in? And what part of the script should exactly be changed?

Sorry for asking a lot.

I assume you mean I should add it here? (Inside the TokenManager script found inside the Modules folder)

But it’s giving me this error, how do I fix it?

image

Once again, really sorry for asking too much.

If you look in that Collection Events section it says you just add a server side script so just insert a Script into ServerScriptService and paste in that code from the webpage and then modify the code I gave above.

1 Like

Ohhh that makes sense, thank you so much!!!

Although this is off topic, this may be the 140,000th post in Scripting Support

1 Like

oh yay I feel special for once!! :3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.