Creating a custom badge system

Introduction

Roblox recently introduced Free Badge Creations! which allowed a larger variety of games to use Badges, Many games try to implement this as a custom system. But you can not read these on your profile, In this tutorial I will teach you how to create a custom badge system while still having it pop up to the profile page.

I hope this will help you, This is my first tutorial. If you have any issues just reply and I will help you!


NOTE: I will be teaching how to make a custom badge pop up system, I will not be teaching how to give a player an non-existent badge.


Scripting

Now in order to start scripting we first need to turn of the badge gui. Thankfully roblox has a function called :SetCore and :SetCoreGui we can turn of the gui like this (This is a local script in StarterGui)

local starterGui = game:GetService(“StarterGui”)

starterGui:SetCoreGuiEnabled(“BadgesNotificationsActive”, false)

At the top we will also add marketPlaceService for the later needs.

local marketPlaceService = game:GetService(“MarketPlaceService”)

Now the BadgeGui will no longer pop up, So now let’s move over to the server. (A new Script in ServerScriptService)


So what our script will have a function that gives a badge to the profile using BadgeService and using a remote event to tell the client to show your custom badge gui.

local badgeService = game:GetService(“BadgeService”)

local function giftBadge(plr, badgeId)
      badgeService:AwardBadge(plr, badgeId)
end

Now in ReplicatedStorage make a new RemoteEvent called “GiftBadge”


We now need to fire that event so at the top add

local replicatedStorage = game:GetService(“ReplicatedStorage”)
local event = replicatedStorage:WaitForChild(“GiftBadge”)

Now in the function giftBadge add

event:FireClient(plr, badgeId)

Now when we call giftBadge() the given player will redeem the badge and the client will receive that it should show the gui but won’t respond in any way, So lets fix that!


(Back to the local script)


Now this is the new code

local starterGui = game:GetService(“StarterGui”)
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local event = replicatedStorage:WaitForChild(“GiftBadge”)

starterGui:SetCoreGui(“BadgesNotificationsActive”, false)

event.OnClientEvent:Connect(function(badgeId)
— ur code here
end)

Now you see the “ur code” line, we will now be working on that!


First make a gui with a namegui and imagegui

Now in order to code it we need to receive badge data, we will be using marketplace service. So at the top make a new variable called marketplace service


Now back to scripting

local gui = —[[ur gui]]:clone()

gui.Visible = true
gui.Size = UDim2.new(0,0,0,0)
gui:TweenSize(—[[ur udim2 size]])

Now when we test it both the name is default, so we will fix this by using marketplace service like this

local gui = —[[ur gui]]:clone()

gui.Visible = true
gui.namegui.Text = marketPlaceService:GetProductInfo(badgeId).Name
gui.Size = UDim2.new(0,0,0,0)
gui:TweenSize(—[[ur udim2 size]])

Now the label will display properly but the image won’t so we have to use a roblox owned api, In order to do so since roblox does not allow you to access the api you need to use a proxy.

For this tutorial we will use RoProxy, I will cover how to do so soon.

17 Likes

There’s a small typo in the post: your quotes are not the standard quote symbols and therefore will error in a script.

image

This is the standard quote symbol: "

3 Likes

Sorry I had to type on my phone, I will try to fix that soon.

1 Like

Incredible! I will defenitly use that for my game!

2 Likes

how should it work…?

1 Like

the error has not been registered by CoreScript means you just need to add a wait for 1 second because it is being called to early.

2 Likes

ty, but i already solved it by making retry cycle

2 Likes