BadgeService3 - A datastore solution to paid badges, for free

Hello again, I made a module called BadgeService3 which allows you to have free badges, instead of having to pay 100 robux to have ONE. You can basically have as many as you want. This is useful for instance, when you need to have a badge for something, but you can’t give the player the badge right now since you don’t have enough robux, with this, it can checked if that player has it and that’s it. Award the player with the actual badge.

And you can also not even use real badges, and only this service, as kind of a Achievement System, if you wanted to.


Before anything, you need to know what you can do, and how to set it up.

How to Set-Up

This is one of the most important parts of this module. Client preparing. It has notifications when a player gets a badge. It’s easy to do that, simply make a LocalScript inside PlayerStarterScripts just like this one:

image

Inside this script, you must require “Client-Side” from the MainModule, to do that, here’s an example:

require(game.ReplicatedStorage:WaitForChild("BadgeService3"):WaitForChild("Client-Side"))

How to Add Badges

Here’s an example of how a badge should look, there’s also an example inside the badges storage;

["Got10Kills"] = {
	Title = "10 Kills!",
	Description = "This badge is awarded when you get 10 kills!",
	Rarity = 100,
	Image = nil -- Can't be decal asset Id, needs to be the image under the decal.
},

You’ll have to insert this inside the Badges Module, under the MainModule.

image

That’s where you’ll put your badges. Remember that this:

image

Is the badgeId, this is what you’ll use to Award, Remove, Check badges. This is the badge Id. There can’t be multiple badges with the same Id.


Now, for the functions included on this module.

Functions

:AwardBadge(plr, badgeId)

This function, as the name implies, let’s you award a badge to a player.
Nothing too special about this one, but it is the most “useful” one.

:RemoveBadge(plr, badgeId)

This function, allows you to remove a player’s badge.
This is less used, but still useful in case, if something goes wrong on your behalf, and someone got a badge that they did not deserve, you can simply use this, to make them not have it anymore.

:UserOwnsBadge(plr, badgeId)

This checks if a player has a badge, if they own it, it return true, if not then, it will return false.
This is very useful, if you wanna convert a badge to a “real” badge.

And also, don’t be scared, Owned badges get saved only when the player leaves. This can be called multiple times, and it will NOT throttle to DataStores.

:GetOwnedBadges(plr)

This returns all badges owned by the player.

:GetBadges()

This returns all badges for you. All info that you gave on the Badges Module.

:GetBadgeInfo(badgeId)

This is essentially the same as GetBadges, when it comes to how similar they “work”.
This returns all info about a badge, It’s rarity, It’s name, description, image… Everything.

:SavePlayerData(plr / void)

This saves a player’s cached info, if the player IS NOT specified, all player’s data will be saved.



And what are the benifits of using this to “regular” badges?
Good you asked.

  1. It contains caching, and uses datastores only when needed, in this case, only when the player joins, leaves, or SavePlayerData() gets called.

  2. It’s literally free, you don’t have to spend money on any badge here. Everything will save, everything will work as expected.

  3. You can use it to convert these badges into “actual” badges later. If you had ever an instance, on which you wanted to give player’s badges, but you COUDN’T, you could just use this instead. And on the future, you could award these players the actual badge, if you wanted to.

Thanks for reading.

This is how you set-it-up, add badges, and all of it’s functions. Be sure to test it, and let me know if there are any glitches, also check the updates post and follow that if you have this module on your game.

Reminders: Set-up is really important. Not doing it can cause the entire module to slow-down, because it keeps checking if the client’s notifications have been loaded. This stops after some attempts, but it’s still recommended to do that.

Also, sorry for the less professional replies by me in the start of the post. I recently rewrote the post because there were too many changes to the module and flaws with the old post. The day I created this I was really tired already;

66 Likes

Decal for the notification system is updated. If theres anything wrong please tell me!

2 Likes

totally gonna use this when i get my game in a working state, now, another question, how did you make those icons, can i have a copy?

2 Likes

So this is basically like an in-game achievements system that doesn’t use actual badges, right?

I think it’d be cool to put together a little (uncopylocked) game to showcase the module in action, so others can try it out and see some example usage.

When you say “Badge Transferring,” what do you actually mean by that?


@Wertyhappy27 if you mean the icons in the Explorer screenshot, that’s Elttob’s new Vanilla icon set for Studio:

Vanilla [1.1] - A modern look for your Studio

8 Likes

A friend helped me get the badge reward file. There’s a mention on the links and stuff.

Oh NVM u were talking about the explorer icons… Sorry he answered it for you

Just means that you can transfer them later to actual badges if you want to. Lol

1 Like

I will probably make a showcase, I really like this module. I ended up just finishing it and testing a bit and published it. So I’ll probably make one;

1 Like

It’s probably better not to use the such similar function names to the Roblox api (e.g. UserOwnsBadgeAsync vs UserHasBadgeAsync) to prevent confusion.

2 Likes

I’m not implying that you should use the exact same function name either, I’m saying it’s probably best to think of a new one. Maybe something like :BadgeOwned()

2 Likes

I mean like, i might add another names for these functions. Just like redirecting it to the actual function

1 Like

i somehow forgot to say that is has a notification system lol
heres an example, the icon is blue instead of yellow.

I found game-breaking glitches with the current version of the module. It’ll be updated soon. Just testing currently.

It’s now fixed :smiley:

2 Likes

Update:

module:GetOwnedBadges() now has caching;
Caching now works properly.
Optimization…
alot of other stuff I don’t remember guys lol

Replace the old version with the old one, the only thing you’ll have to do is copy the “virtualBadges” variable from your old one into the new one.

2 Likes

So does this use datastores or not?

1 Like

Yes that’s how you store that info, there’s no other way. This is not based around ACTUAL badges.

These are different but based around the same idea.

What I’m asking is does this save which badges a player has achieved.

1 Like

Yes? As long has you have datastores enabled, yes.

3 Likes

Custom notification image support coming soon!

1 Like

Hm, Interresting resource.

But i have a feedback: You should make UI support instead of just notifications.
(to make more customizable)

2 Likes

Wow this is great! But how can I basically use it?

1 Like

The tutorial is there to set it up, anything else is just based around the functions.