So continuing from this topic I made - > How can I make my overhead gui check if a player has a badge and if so display "Early Tester" - #3 by Zentryte
I got it to work BUT it only works in the game not the place connected to the game
This is the scripts now V
local Players = game:GetService("Players")
local rankInformation = require(script.RankInformation)
local connections = {}
local overHeadTemplate = script.OverheadGui
Players.PlayerAdded:Connect(function (player)
connections[player] = player.CharacterAdded:Connect(function (character)
local newOverhead = overHeadTemplate:Clone()
newOverhead.PlayerName.Text = player.Name
for _, info in pairs (rankInformation) do
local isPlayerInDivision = player:IsInGroup(info.groupId)
if isPlayerInDivision then
newOverhead.Group.Text = info.name
newOverhead.Group.TextColor3 = info.color
newOverhead.Group.Visible = true
newOverhead.Rank.Text = player:GetRoleInGroup(info.groupId)
newOverhead.Rank.Visible = true
end
end
character:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
newOverhead.Parent = character:WaitForChild("HumanoidRootPart")
end)
end)
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local badgeID = 2124639978 -- Change this to your badge ID
local connections = {}
local overHeadTemplate = script.OverheadGui
local function onPlayerAdded(player)
-- Check if the player has the badge
local success, hasBadge = pcall(function()
return BadgeService:UserHasBadgeAsync(player.UserId, badgeID)
end)
-- If there's an error, issue a warning and exit the function
if not success then
warn("Error while checking if player has badge!")
return
end
if hasBadge then
overHeadTemplate.Tester.Visible = true
end
end
-- Connect "PlayerAdded" events to the "onPlayerAdded()" function
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(function (player)
if connections[player] then
connections[player]:Disconnect()
connections[player] = nil
end
end)
As you can see when i play my testing game i have a badge from that game and it gives you the “early tester text”
But if I go in my game Im working on and select a map that brings you to another PLACE connected to the game it wont show it