Disabling a gui inside of startercharacterscripts for the local player only

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:
image

with it set out like this:
image

Looks like this in game:

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

1 Like

Maybe this is what your looking for? BillboardGui.PlayerToHideFrom

doesnt seem to work either, I have this inside a local script in the billboard gui:
image

Works for me if I just use this in a local script inside the billboard object:

local bb = script.Parent
bb.Enabled = false

This works too:

local bb = script.Parent
bb.PlayerToHideFrom = game:GetService("Players").LocalPlayer
1 Like

Strange, neither work for me, is yours set out in the same structure as mine?
image

Cant think of any other reason why it wouldnt work

tempss

Weird, cant think as to why it wont work then

Works if I put a wait(0.1) in the script, thanks for the help.

1 Like

Just to be thorough you should check other scripts that have anything to do with the bbGui. It maybe that one of them is enabling it.

1 Like

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