How do I delete for both PlayerGui and StarterGui from a Server Script?

My current issue is that I’m trying to clone a BilllboardGui as a ‘name’ for this NPC and made a script to delete the Gui when the NPC dies. However, my script only deletes BillboardGui in the StarterGui and not for PlayerGui. Is there any way around this?

(I’m doing this so that I can reduce amount of unnecessary unused GUIs in my server upon NPC regen)

Sorry, it has been around a week since I started coding so such an issue is due to my naivety and inexperience…

local function Gui()
	local storedgui = game.ServerStorage.Merchant:Clone()
	storedgui.Parent = game.StarterGui.Billboards.NPC
	storedgui.Adornee = script.Parent:FindFirstChild("Head")
return storedgui


local gui = Gui() -- basically storedgui will be what this variable is

local humanoid = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("Torso") -- this is assuming the npc model has a Torso

1 Like

The starter gui only changes what gui is given to new players. Here your Parenting the gui to the StarterGui and not the current PlayerGui

	storedgui.Parent = game.StarterGui.Billboards.NPC

Is there a way for me to delete it both StarterGui and PlayerGui? Because it appears on PlayerGui as well.