BadgeService3 - Free badges!

This post is a re-post from the DevForum.

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!

3 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 use 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.


Here is the Roblox Model in case you prefer it:

1 Like

Examples:

How to use with Nevermore Engine's datastore solution

Provided by @ShockwaveProductions!

local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")

local PlayerDataStoreManager = Nevermore("PlayerDataStoreManager")
local badgeService3 = Nevermore(game.ReplicatedStorage.BadgeService3)

local dataStoreManager = PlayerDataStoreManager.new(DataStoreService:GetDataStore("PlayerData"), function(player) return tostring(player.UserId) end)

function loadBadges(player, store)
	return store:Load("Badges", {}):Then(function(data)
		return badgeService3:LoadProfile(player, data)
	end):Catch(function(...)
		warn("Failed to load", ...)
	end)
end

function handlePlayerAdded(player)
	local dataStore = dataStoreManager:GetDataStore(player)
	local badgeStore = dataStore:GetSubStore("BadgeStore")
	
	loadBadges(player, badgeStore):Then(function(profile)
		delay(5, function()
			if profile.Data then
				profile:AwardBadge("Welcome")
			end
		end)

		profile:onUpdate(function()
			badgeStore:Store(profile.Data)
		end)		
	end):Catch(function()
		player:Kick()
	end)
end

Players.PlayerAdded:Connect(handlePlayerAdded)
for _, player in pairs(Players:GetPlayers()) do
	handlePlayerAdded(player)
end
How to use with DataStore2

How to set-up BadgeService3 with DataStore2 - YouTube

How to use with ProfileService
--\\ Pseudo-code!

local Players = game:GetService('Players');
local profileService = require(game.ServerScriptService.ProfileService)
local profileStore = profileService.GetProfileStore("PlayerData", {
    Cash = 0;
    Badges = {};
})

local badgeService3 = require(game.ReplicatedStorage.BadgeService3)

local function onPlayerAdded(plr)
    local profile = profileStore:LoadProfileAsync("Player_"..plr.UserId, "ForceLoad")
    if profile then
        local badgeProfile = badgeService3:LoadProfile(plr, profile.Data.Badges)
        delay(5, function()
            if plr.Parent ~= Players then return end;
            badgeProfile:AwardBadge("Welcome")
        end)
        badgeProfile:onUpdate(function()
            profile.Data.Badges = badgeProfile.Data
        end)
    else
        plr:Kick()
    end
end

for _, plr in ipairs(Players:GetPlayers()) do
    coroutine.wrap(onPlayerAdded)(plr);
end

Players.PlayerAdded:Connect(onPlayerAdded)
2 Likes

This is great for an upcoming developer without any Robux! Love the system.

2 Likes

I may have to try this. Even though I have plenty of robux to buy badges. I don’t always want to drop a ton of robux on testing games.

3 Likes

That seems like a great system, great job! I might even use it for my game :smiley:

2 Likes