NEW TUTORIAL: (NEW) Custom Badge Notification Tutorial
I don’t feel like explaining too much right now, so I’ll explain everything briefly.
I’ll probably make a much more detailed tutorial later, but let’s just get into the tutorial.
Make sure to have a badge ready and to have a Badge UI similar to this (No need to have the UICorners, Gradients, and stuff):
After you have the UI set up, move it into the replicated storage
Now insert a local script into StarterPlayerScripts (located in StarterPlayer):
Now copy and paste this code that disables the default badge notification:
game:GetService("StarterGui"):SetCore("BadgesNotificationsActive",false)
After that, insert a module script into the ServerScriptService named BadgeUI and insert this code in between the local module = {}
and return module
:
function module.OpenBadgeUI(UserId,BadgeId)
local Name = game:GetService("Players"):GetNameFromUserIdAsync(UserId)
local BadgeUI = game:GetService("ReplicatedStorage").Badge:Clone()
local frame = BadgeUI.Frame
local TS = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
2,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut,
0,
false,
0.2
)
local positionTweenOpen = TS:Create(
frame,
tweenInfo,
{Position = UDim2.new(-- Your open position)}
)
local positionTweenClose = TS:Create(
frame,
tweenInfo,
{Position = UDim2.new(-- Your closed position)}
)
BadgeUI.Parent = game:GetService("Players")[Name].PlayerGui
frame.Title.Text = game:GetService("BadgeService"):GetBadgeInfoAsync(BadgeId).Name
frame.Description.Text = game:GetService("BadgeService"):GetBadgeInfoAsync(BadgeId).Description
frame.Icon.Image = "https://www.roblox.com/asset/?id="..game:GetService("BadgeService"):GetBadgeInfoAsync(BadgeId).IconImageId
positionTweenOpen:Play()
task.wait(8) -- You can change this to the time you want the badge to stay on the screen for (in seconds)
positionTweenClose:Play()
positionTweenClose.Completed:Connect(function()
BadgeUI:Destroy()
end)
end
I believe that this shouldn’t be too hard to change, so let’s use this module in this welcome badge script. Insert a server script into the ServerScriptService and name the script WelcomeBadge and insert this code:
local BadgeId = -- Your Badge ID
local BadgeUI = require(script.Parent.BadgeUI)
local BadgeService = game:GetService("BadgeService")
game:GetService("Players").PlayerAdded:Connect(function(plr)
local userId = plr.UserId
task.wait(2)
if not BadgeService:UserHasBadgeAsync(userId,BadgeId) then
BadgeService:AwardBadge(userId,BadgeId)
BadgeUI.OpenBadgeUI(userId,BadgeId)
end
end)
Video:
Yeah, that’s it. This should work. If it doesn’t, let me know. If you have any concerns, feel free to let me know. Thanks for reading.