I have a script that displays an overhead gui that shows display name, username and level. It seems to be perfectly working with R6 characters but when I switch over to R15 characters which is what my game will be the script no longer works at all.
The script:
local OverheadGui = script.OverheadGui:Clone()
local function updateOverheadGui(player)
local character = player.Character
if character then
local leaderstats = player:WaitForChild("leaderstats")
local level = leaderstats:WaitForChild("Level")
OverheadGui.Username.Text = player.DisplayName .. " (@" .. player.Name .. ")"
OverheadGui.Level.Text = "Level: " .. level.Value
OverheadGui.Parent = character:WaitForChild("Head")
level.Changed:Connect(function(newValue)
OverheadGui.Level.Text = "Level: " .. newValue
end)
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
updateOverheadGui(player)
end)
updateOverheadGui(player)
end)
Is Level spelt correctly on the TextLabel? Sometimes there might be a trailing space at the end or at the beginning that could cause an error. These are different things Level and Level
Just figured out the issue… So I took off my headless head and then it works. I never thought of this as when I joined the studio it still said I had a head (which is in the image). Why does it not work with the headless head since it’s still a head just transparent.