BadgeService3 | Set up badges for free in your project!

Hi, this is the v2 of BadgeService3, BadgeService3 allows you to have free badges, without paying 100 robux, using datastores. It allows even for notifications!

BadgeService3 is light-weight and easy to use!

It’s super easy to use, and to add to your current datastoring! The data is loaded by you, and then you can do whatever you want to it, award a badge, remove a badge, get owned badges, check if a badge is owned, etc :D

You can add it to your DS2 or ProfileService system easily if you want! It’s entirely local, no datastore work is done by this v2.

If you want to connect this to your ProfileService system, look at the documentation, there’s an entire example of how to do it!


Download :sparkles: Documentation :sparkles: Set-Up :sparkles: Source Code

Updates


Here’s for example, how a badge will look when it’s awarded to the player!

image


I hope you guys like it!

Also special thanks to @7z99 for helping me get the badge award icon!

65 Likes

Why use BadgeService3?

BadgeService3 is a profile-based module which allows you to have free badges, with notifications, and everything you need. Unlike some other options, it allows you to connect it to other datastoring modules, or mechanics. You can ue it for example, with DataStore2, or ProfileService, and many others, or just simple-old normal datastores.

But WHY use it? Why do I need free badges?

They can be used as normal badges, or to migrate later to actual badges. It woudn’t be hard to do so either. It allows you to easily keep, and also create an illusion that someone got a badge, when did they didn’t. For example, if you want to have an event, and keep a badge to the people who participated, you can do that with BadgeService3. Later on, you can create an actual badge for it.

8 Likes

I have a question, should I make this a roblox model?
I am not sure as people usually like roblox models because it’s easier to grab, how ever, a lot people prefer going for github links instead.

Should I make this a roblox model?
  • Yes.
  • No.

0 voters

It looks like most people want one, here it is.

https://www.roblox.com/library/6525256722/BadgeService3

4 Likes

One word for this model:
Interesting

5 Likes

interesting…
also, the badges don’t show up on the player’s inventory ‘badges’ section right (ofc they don’t)

1 Like

It’s still useful for in-game achievement tracking though.

3 Likes

No they don’t, that’s literally impossible. However, it’s a “simulator” for that effect. The main thing being that you can turn these into actual badges later without doing much. I actually plan on adding something to allow you to do that even more easily.


I would love if anyone were to test this module in a project or really anything for me. If you did use this, I would love to see your opinion and feedback, this module was only used at my game on which I wanted to combine all DataStore use into one key. This only was released because someone wanted acess to this v2 and I decided to give it to them. I don’t know if I can name them but um yeah.

Anyhow, this has been a thing for a bit of time, I was gonna release it but “forgot” to. Then I kind of did a rewrite of some stuff and released it.

1 Like

Also, the icon is gold/yellow not blue (for the badge received icon)

1 Like

Yeah, that’s actually intentional, I didn’t want it to stay the same so that people could notice it wasn’t quite roblox badges.

Maybe make it like customizable like u could change it to goal reached or achievement achieved ya know?
also make it look less like roblox badge some people might have thought that image was actual real getting a badge.

1 Like

Thanks for the idea. I might add some function to change this setting globally. Expect that soon (maybe) when I get time.

I know DS2 has something like .PatchGlobalSettings() or something, I guess that’s achievable here.

In the v1 you were able to use the badge’s “picture” as the notification image, that might become a thing here as well.

If anyone runs into issues, try submitting a issue on GitHub. I kind of just want it like that because I wanna use GitHub more lol.

1 Like

Love this. Have a quick question though, how would I make a gui that displays how many badges a player owns out of the total amount of badges like “2/12 badges owned”? Like get the two number values. I have put these print statements but both output wrong.

if profile then
        local badgeProfile = badgeService3:LoadProfile(plr, profile.Data.Badges)
        delay(5, function()
            if badgeProfile.Data then
                    local owned = badgeProfile.Data
					local badgers = BadgeService3:GetBadges()
					print(#owned)
					print(#badgers)
                badgeProfile:AwardBadge("Welcome")
            end
        end)

both print 0 though…
image
Here are the two badges right now.
image
Does the print statements not return because they are dictionaries and the #(table) only works on arrays? Would I have to loop through the tables and count the items in them instead?

1 Like

Actually # should works on any table. This is pretty odd, can you try printing what these are before printing how many values are inside them? Btw, :GetOwnedBadges() actually returns an array! So it would work, you’re using :onUpdate() to update the profile store profile right?

I just noticed you’re using profile.Data to count the badges, it’s fine, but try using :GetOwnedBadges() for testing. It will transform it into an array, so it should work.

If it ends up not really working, i guess you can illerate through the table if it ends up not working.

1 Like

# only works on arrays and partially on mixed tables.

Ordered indexes (numerical keys) are always counted, but keys are not counted by # and are instead skipped.

5 Likes

Oh ok, then yes @motlopoway, you would have to use a for loop or keep that number somewhere for the :GetBadges(), since :GetOwnedBadges() returns an array, you can use # on it.

Your request was added to the milestones of this module.

@motlopoway also added that to milestones, some function could be useful.

2 Likes

(pool removed, just went with per-profile onBadgeAwarded event)

I actually forgot to talk about this, but I still recommend using :Delete() if you’re working with your own solution. In this case basic datastores, BadgeService3 currently yields for 5 seconds before garbage collecting the profile automatically. I still highly recommend that you do a DeepCopy of the profile.Data table before trying to save if you’re messing around with basic datastore use. This is not needed if you’re using a solution like ProfileService/DS2 which changes data as it changes.

1 Like

Shouldn’t it just be called BadgeService4?

That’s a bit much lol! I just call it a v2, BadgeService4 would sound weird. BadgeService3 already does, It should have been called BadgeService2 from the start to be honest.

2 Likes

Update released, 1.5.0

Changes:

  • :onBadgeAwarded(function(badgeId) RBXScriptSignal added. Will fire only when a badge is awarded.

  • New customizable settings! Look at these!

["usesBadgeImageForNotifications"] = false;
["isNotificationsDisabled"] = false;
["usesGoldBadgeNotification"] = false;
["defaultBadgeNotificationImage"] = "rbxassetid://6170641771";
["notificationDuration"] = 5;
["autoGarbageCollectProfileTime"] = 5;
["NotificationDescription"] = 'You have been awarded "%s"!';
["NotificationTitle"] = "Badge Awarded!"
  • New function added to BadgeService3, :SetGlobalSettings(SettingsTable), this function will change the settings you ask for!

  • New usable “variable” into badges, Image which can be set to a image id, not a decal id, and with the setting usesBadgeImageForNotifications enabled, it will use that as the notification image for that badge.

  • New function added :GetBadgeAmount() will return you the number of all badges.

  • :GetBadges() will now return the badges, and also the result from :GetBadgeAmount()

Customization highlights:

  • Disable notifications! isNotificationsDisabled
  • Add your own notification system if you want! using :onBadgeAwarded()
  • Use the default, gold color for the badge notification! usesGoldBadgeNotification
  • Change the default notification image to whatever you want! defaultBadgeNotificationImage
  • Use specific badge images! usesBadgeImageForNotifications
  • Change the notification’s text, and description! NotificationDescription and NotificationTitle
  • more…

If you use BadgeService3, please follow the update topic.
That’s where updates will be kept now.

1 Like