I have this issue where the OverHead UI will not load in, heres the script below:
local Players = game:GetService("Players")
local BillBoardGui = Instance.new("BillboardGui")
local DisplayNameLabel = Instance.new("TextLabel")
local RankLabel = Instance.new("TextLabel")
-- Set properties for the BillBoardGui
BillBoardGui.Size = UDim2.new(3, 0, 3, 0)
BillBoardGui.StudsOffset = Vector3.new(0, 2, 0)
BillBoardGui.AlwaysOnTop = true
BillBoardGui.Enabled = true
-- Set properties for the DisplayNameLabel
DisplayNameLabel.Size = UDim2.new(1, 0, 0.5, 0)
DisplayNameLabel.Position = UDim2.new(0, 0, 0, 0)
DisplayNameLabel.TextScaled = true
DisplayNameLabel.BackgroundTransparency = 1
DisplayNameLabel.TextColor3 = Color3.new(1, 1, 1)
DisplayNameLabel.TextStrokeTransparency = 0
DisplayNameLabel.Font = Enum.Font.SourceSans
DisplayNameLabel.Text = ""
DisplayNameLabel.Parent = BillBoardGui
-- Set properties for the RankLabel
RankLabel.Size = UDim2.new(1, 0, 0.5, 0)
RankLabel.Position = UDim2.new(0, 0, 0.5, 0)
RankLabel.TextScaled = true
RankLabel.TextSize = 14
RankLabel.TextXAlignment = Enum.TextXAlignment.Center
RankLabel.BackgroundTransparency = 1
RankLabel.TextColor3 = Color3.new(1, 1, 1)
RankLabel.TextStrokeTransparency = 0
RankLabel.Font = Enum.Font.SourceSans
RankLabel.Text = ""
RankLabel.Parent = BillBoardGui
-- Function to update the RankLabel with the player's rank
function updateRankLabel(player)
local rank = "" -- default rank is empty string
-- Set the rank according to the player's group membership
if player:IsInGroup(16516466) then
rank = player:GetRankInGroup(16516466)
else
rank = "Guest"
end
-- Update the RankLabel with the player's rank
RankLabel.Text = rank
end
-- Create the BillBoardGui for each player when they join the game
Players.PlayerAdded:Connect(function(player)
local playerBillBoard = BillBoardGui:Clone()
playerBillBoard.Parent = player.Character
playerBillBoard.Name = player.Name .. "BillBoard"
playerBillBoard.Enabled = true
-- Update the DisplayNameLabel with the player's name
DisplayNameLabel.Text = player.DisplayName
-- Update the RankLabel with the player's rank
updateRankLabel(player)
-- Update the RankLabel whenever the player's rank changes
player.Changed:Connect(function(property)
if property == "MembershipType" then
updateRankLabel(player)
end
end)
end)
-- Remove the BillBoardGui for each player when they leave the game
Players.PlayerRemoving:Connect(function(player)
if player.Character then
local playerBillBoard = player.Character:FindFirstChild(player.Name .. "BillBoard")
if playerBillBoard then
playerBillBoard:Destroy()
end
end
end)
I’ve set it to create a BillBoard and TextLabels for me. Though the BillBoard UI is supposed to be over the players head although it does not appear at all. I apologize if this looks oddly messy.