Badge+ | Badges made easier

BADGE+
Badge+ is a plugin that can let you easily access badge templates that you will only need to change the id of! It contains multiple templates of badges and will always update with new ones! This is useful for developers who do not want to write a badge for every game they make and can access it with a click of a button!



Any feedback or criticism you give is greatly appreciated! This is one of my 2nd plugins so it might not be the best!


Plugin Link | Badge+
Plugin Server | Discord Server

29 Likes

Maybe create a GitHub repo with the templates and the plugin fetches the templates from GitHub. This allows for community-made badge templates.

1 Like

Thank you for the suggestion, I am not really familiar with github repo but I will try and connect it in some way!

Awesome!

I think it will be useful for developers who are just starting out and don’t know about it. And you will help them. And it looks nice even though you did it plugin as the 2nd.
Good work!

1 Like

This plugin looks very helpful! It’d be cool if you added a way to insert a template with one of the game’s badges.

How do I do that?

This is a difficult concept if you don’t have API experience, so I made this code to help if you like the idea. This code works as-is and can be added to the plugin. This can also be used beyond the plugin for curious people, hence this reply.

-- Variables:

local badges = {}
local httpService = game:GetService("HttpService")
local placeId = game.PlaceId

-- Check to see if place is published?

if placeId ~= 0 then
	-- Attempt to make a http request to my roblox proxy
	local success,response = pcall(function()
		return httpService:JSONDecode(httpService:GetAsync(("https://rbx-badge.glitch.me/game/%s"):format(placeId)))
	end)
	-- See if it responded and has a valid response
	if success and response then
		if response.success then -- Everything went well!
			badges = response.badges
		else -- Something went wrong on the server
			warn("Error fetching badges internally - " .. response.message)
		end
	else -- Something errored on Roblox's side
		warn("Error getting badges - " .. response)
	end
end

for _,badge in pairs(badges) do --> Loop through badges
	print(badge.name) -->  Badge name
	print(badge.id) --> Badge id
	print(badge.description) --> Badge description
	print(badge.imageId) --> Badge image
	print(badge.enabled) --> Is it enabled for use?
end

I also examined some of the code and I found a way to shorten your BadgeInserter module.

Click

Notes:

  • It’s good practice to use ‘game:GetService’ instead of directly stating the service name
  • You can use dictionaries to shorten this like below
local BadgeInserter = {}


local BadgesFolder = script.Parent.Parent.Parent.Resources.Badges


function BadgeInserter.WelcomeBadge()
	local WelcomeBadgeScript = BadgesFolder.WelcomeBadge
	local clone = WelcomeBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Welcome Badge has been inserted.")
	game.ServerScriptService.WelcomeBadge.Disabled = false
end


function BadgeInserter.TimeBadge()
	local TimeBadgeScript = BadgesFolder.TimeBadge
	local clone = TimeBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Time Badge has been inserted.")
	game.ServerScriptService.TimeBadge.Disabled = false
end


function BadgeInserter.PromptBadge()
	local PromptBadgeScript = BadgesFolder.PromptBadge
	local clone = PromptBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Prompt Badge has been inserted.")
	game.ServerScriptService.PromptBadge.Disabled = false
end


function BadgeInserter.PartBadge()
	local PartBadgeScript = BadgesFolder.PartBadge
	local clone = PartBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Part Badge has been inserted.")
	game.ServerScriptService.PartBadge.Disabled = false
end

function BadgeInserter.GroupBadge()
	local GroupBadgeScript = BadgesFolder.GroupBadge
	local clone = GroupBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Group Badge has been inserted.")
	game.ServerScriptService.GroupBadge.Disabled = false
end

function BadgeInserter.GamepassBadge()
	local GamepassBadgeScript = BadgesFolder.GamepassBadge
	local clone = GamepassBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Gamepass Badge has been inserted.")
	game.ServerScriptService.GamepassBadge.Disabled = false
end


function BadgeInserter.DiedBadge()
	local DiedBadgeScript = BadgesFolder.DiedBadge
	local clone = DiedBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Died Badge has been inserted.")
	game.ServerScriptService.DiedBadge.Disabled = false
end


function BadgeInserter.CreatorBadge()
	local CreatorBadgeScript = BadgesFolder.CreatorBadge
	local clone = CreatorBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+]  Creator Badge has been inserted.")
	game.ServerScriptService.CreatorBadge.Disabled = false
end

function BadgeInserter.ClickBadge()
	local ClickBadgeScript = BadgesFolder.ClickBadge
	local clone = ClickBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+] Click Badge has been inserted.")
	game.ServerScriptService.ClickBadge.Disabled = false
end

function BadgeInserter.ChatBadge()
	local ChatBadgeScript = BadgesFolder.ChatBadge
	local clone = ChatBadgeScript:Clone()
	clone.Parent = game.ServerScriptService
	print("[BADGES+] Chat Badge has been inserted.")
	game.ServerScriptService.ChatBadge.Disabled = false
end


return BadgeInserter

to

local BadgeInserter = {}
local ServerScriptService = game:GetService("ServerScriptService")
local BadgesFolder = script.Parent.Parent.Parent.Resources.Badges

local BadgeTypes = {
	["WelcomeBadge"] = BadgesFolder.WelcomeBadge,
	["TimeBadge"] = BadgesFolder.TimeBadge,
	["PromptBadge"] = BadgesFolder.PromptBadge,
	["PartBadge"] = BadgesFolder.PartBadge,
	["GroupBadge"] = BadgesFolder.GroupBadge,
	["GamepassBadge"] = BadgesFolder.GamepassBadge,
	["DiedBadge"] = BadgesFolder.DiedBadge,
	["ClickBadge"] = BadgesFolder.ClickBadge,
	["CreatorBadge"] = BadgesFolder.CreatorBadge,
	["ChatBadge"] = BadgesFolder.ChatBadge
}

function Insert(Name,Badge)
	local clone = Badge:Clone()
	clone.Parent = ServerScriptService
	clone.Disabled = false
	print(("[\"BADGES+\"] %s Badge has been inserted."):format(Name:split("Badge")[1]))
end

for name,badge in pairs(BadgeTypes) do
	BadgeInserter[name] = function()
		Insert(name,badge)
	end
end

return BadgeInserter

You could even further shorten it with :GetChildren(), but I’ll leave that up to you.

Sincerely, Jumpathy

3 Likes

Thank you so much for the feedback and help with very detailed messages! You are going to be a big help! I am happy this is helpful for people as this is one of my first ever plugins!

Moving into the template idea I think I will try my best to implement that when I am on pc, it would help a lot for there to be templates!

For your improvement o generally put them into separate functions because in the main script I called them when they clicked a button, would this improvement still work with that?

3 Likes

Great idea and will be useful for many new creators!

1 Like

It should, let me know if it doesn’t.

1 Like

It does work thank you so much for making my code more efficient and easier!

Sorry for annoying you but now that I am on PC I see your api code more! Could you possibly tell me how to implement this into my plugin? What I mean is what script does it have to be in and such

You could also use :GetChildren() to shorten the code below

Code
HomeButton.MouseButton1Click:Connect(function()
	SoundModule.ClickSound()
	homePage()
end)

BadgesButton.MouseButton1Click:Connect(function()
	SoundModule.ClickSound()
	badgesPage()
end)

------

WelcomeBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.WelcomeBadge()
end)

TimeBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.TimeBadge()
end)

PromptBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.PromptBadge()
end)

PartBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.PartBadge()
end)

GroupBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.GroupBadge()
end)

GamepassButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.GamepassBadge()
end)

DiedBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.DiedBadge()
end)

CreatorBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.CreatorBadge()
end)

ClickBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.ClickBadge()
end)

ChatBadgeButton.MouseButton1Click:Connect(function()
	SoundModule.CompleteSound()
	BadgeInserter.ChatBadge()
end)

to

function OnChild(child)
	if child:IsA("TextButton") then -- make sure it's actually a text button
		SoundModule.CompleteSound() -- play your sound 
		BadgeInserter[child.Name]() -- call the badge inserter with the button's name (ex: if the button is named TestBadge it'll call .TestBadge() on your BadgeInserter)
	end
end

for _,child in pairs(BadgesListFrame:GetChildren()) do -- check all the buttons in the frame
	task.spawn(OnChild,child)
end
BadgesListFrame.ChildAdded:Connect(OnChild) -- any buttons added to the frame also will also do the same

You can do that with a lot, :GetChildren() is like literally god lol
(that should work but I haven’t tested it)

2 Likes

This code looks more efficient but sadly does not work cause they are not clicking a button to insert it, so theres no function for MouseButton1Click

Oops I’m dumb lol knew I forgot something

function OnChild(child)
	if child:IsA("TextButton") then -- make sure it's actually a text button
		SoundModule.CompleteSound() -- play your sound 
		child.MouseButton1Click:Connect(BadgeInserter[child.Name]) -- call the badge inserter with the button's name (ex: if the button is named TestBadge it'll call .TestBadge() on your BadgeInserter)
	end
end

for _,child in pairs(BadgesListFrame:GetChildren()) do -- check all the buttons in the frame
	task.spawn(OnChild,child)
end
BadgesListFrame.ChildAdded:Connect(OnChild) -- any buttons added to the frame also will also do the same
2 Likes

That works thank you so much! Also its ok we all make mistakes lol. Now my plugin can be shorter and easier to learn for other people when they view its source!

1 Like

BADGE+
Version 1.1


Updates:

  • Added Updates Ui
  • Optimized inserting to make it better and not mess up on the wrong badge
  • Edited Badge scripts to work better!

Bug Fixs:

  • Fixed plugins interface compatibility
  • Fixed bug where it would insert the wrong script.
  • Fixed bug where it will not let you click the home button!

Going to take a break but make sure to put your ideas
Also have a good day :slight_smile:

3 Likes

BADGE+
Version 1.2


Updates:

  • Whole new UI, and revamp of the whole plugin.
  • New gamepass section coming soon…
  • Settings

Bug Fixes:

  • Fixed some ui buttons not working.
  • Fixed Settings not opening
  • Fixed badge print message wrong.
Showcase

Picture

the new UI update kinda broke on me so now I have to close my properties tab each time I want to use this


It’s getting a bit frustrating

1 Like

I’m so sorry about this ill work on it very soon.

1 Like

no worries, take your time! and thank you for replying

1 Like

Pushed out a temporary fix, I will try making the frames draggable over the weekend, thank you so much for actually using my plugin I didn’t expect people to use this.

1 Like