Im trying to make a script to disable a custom above head health bar gui for the local player only while still being visible to everyone else but my script doesnt work, ive tried a few different ones but right now its just this:
Ive tried having the local script inside the gui and just doing script.parent but that doesnt work either. seems like it should be simple enough to do but I must be missing something
Likely because the script is executed before the BillboardGui has been correctly cloned into the local player’s character.
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local billboardGui = script.Parent
if not billboardGui:IsDescendantOf(character) then
billboardGui.AncestryChanged:Wait()
end
billboardGui.PlayerToHideFrom = player