-
What do you want to achieve?
I’m trying to make a overhead GUI that just shows others that you are the owner to test my abilities. -
What is the issue?
When I finished the script I realized that it wasn’t working, so I added prints until I pin pointed the error location to the .PlayerAdded() event which doesn’t run my print. -
What solutions have you tried so far?
I tried looking from topics like “overhead billboard GUI not working” and “.PlayerAdded() not working”, but none of their solutions worked for me.
-- info
local autoOwner = true -- true if it should automatically choose the owner of the game
local ownerId = "" -- put owner userID here if autoOwner is false
local ownerName = "" -- you dont need to fill this in
-- customization
local TagColor = Color3.fromRGB(197, 0, 3) -- enter RGB values into there parentheses
local TagStroke = true
local TagStrokeColor = Color3.fromRGB(80, 0, 1)
local NameColor = Color3.fromRGB(0, 0, 0)
local NameStroke = true
local NameStrokeColor = Color3.fromRGB(255, 255, 255)
if autoOwner and game.CreatorType == Enum.CreatorType.User then
ownerName = game:GetService("Players"):GetNameFromUserIdAsync(game.CreatorId)
ownerId = game.CreatorId
elseif autoOwner and game.CreatorType == Enum.CreatorType.Group then
local groupInfo = game:GetService("GroupService"):GetGroupInfoAsync(game.CreatorId)
ownerName = groupInfo.Owner.Name
ownerId = groupInfo.Owner.Id
else
local success, errorMsg = pcall(function()
ownerName = game:GetService("Players"):GetNameFromUserIdAsync(ownerId)
end)
if not success then warn("Invalid ownerID or failed to get it. ERROR: "..errorMsg) end
end
local NT = script.PlayerTitle.Plr
local TT = script.PlayerTitle.Tag
NT.TextColor3 = NameColor
if NameStroke then NT.TextStrokeColor3 = NameStrokeColor end
TT.TextColor3 = TagColor
if TagColor then TT.TextStrokeColor3 = TagStrokeColor end
local function createTag(plr, char)
if plr.UserId == ownerId and char:WaitForChild("Head"):FindFirstChild("PlayerTitle") == nil then
local bill = script.PlayerTitle:Clone()
bill.Plr.Text = ownerName
bill.Parent = char:WaitForChild("Head")
end
end
game:GetService("Players").PlayerAdded:Connect(function(plr)
print("Player joined")
plr.CharacterAdded:Connect(function(char)
createTag(plr, char)
end)
local char = workspace:WaitForChild(plr.Name)
createTag(plr, char)
end)
--script.Parent = game:GetService("ServerScriptService")
My guess is that the lines above the event yield the script too much and it isn’t fast enough to start detecting the event.