Place this inside a Script
(LocalScripts only run on the client and do not replicate) in ServerScriptService
:
local Players = game:GetService("Players")
local Sample = script:WaitForChild("OverheadGui")
function PlayerAdded(player)
local function update(char)
if not char then return end
local Head = char:WaitForChild("Head", 5)
if not Head then return end
local GUI = Sample:Clone()
local Info = GUI.InfoLabel
Info.Text = player.Name
local team = player.Team
if team then
Info.Text ..= " "..team.Name
end
GUI.Parent = Head
end
player:GetPropertyChangedSignal("Team"):Connect(function()
update(player.Character)
end)
update(player.Character or player.CharacterAdded:Wait())
player.CharacterAdded:Connect(update)
end
for i, player in pairs(Players:GetPlayers()) do
PlayerAdded(player)
end
Players.PlayerAdded:Connect(PlayerAdded)
You have to parent OverheadGui to the script.
1 Like
The script does work, the UI itself is not displayed right.
Apply the following properties to InfoLabel
:
TextScaled = true
AnchorPoint = 0.5,0.5
Position = 0.5,0,0.5,0
Size = 3,0,1,0
2 Likes
Not exactly the write size and postition but ill figure it out
1 Like