Billboard GUI resets when player died

So, I’ve recently made a command which the billboard gui will show up when the command is executed. But, when the player died, the billboard gui would disappear. How do I fix this?

Script:

local kos = script.KoS:Clone()
local SOD = 12648334
local SoDRank = 1
local SD = 12648370
local SDRank = 1
local TJC = 12696358
local TJCRank = 1
local CPD = 12648361
local CPDRank = 1
local ID = 12648336
local IDRank = 1

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		plr.Chatted:Connect(function(msg)
			if plr:GetRankInGroup(SOD) >= (SoDRank) or plr:GetRankInGroup(SD) >= (SDRank) or plr:GetRankInGroup(TJC) >= (TJCRank) or plr:GetRankInGroup(ID) >= (IDRank) or plr:GetRankInGroup(CPD) >= (CPDRank) then
				if msg == "kos ".. plr.Name then
					kos.Parent = char.Head
					kos.ImageLabel.Visible = true
				elseif msg == "revoke kos ".. plr.Name then
					kos.ImageLabel.Visible = false
				end
			end
		end)
	end)
end)



ResetOnSpawn doesn’t work also.

2 Likes

So, when ResetOnSpawn is set to false, that doesn’t work?

1 Like

It doesn’t work, I already tried doing it.

1 Like

Try saving the data of the player and load it on the BillboardGui whenever the player respawns, if the character is destroyed, the gui also resets because it’s a descendant of it, i think thats the reason.

2 Likes

So, I’m going to use a datastore?

1 Like

Try defining Kos normally and cloning Kos inside the chatted event, looks like it’s only cloning once.

If you want it to not be destroyed when the player dies put it in an invisible part instead of the head and set the part position to the head position

2 Likes

The aos command does work, but the revoke doesn’t. I did putted the cloned aos after the chatted event, and the normal local kos on the first line.

local aos = script.AoS

local SOD = 12648334
local SoDRank = 1
local SD = 12648370
local SDRank = 1
local TJC = 12696358
local TJCRank = 1
local CPD = 12648361
local CPDRank = 1
local ID = 12648336
local IDRank = 1
local FBIGroup = 12648144
local FBIRank = 250

game.Players.PlayerAdded:Connect(function(plr) --plr as a variable
	plr.CharacterAdded:Connect(function(char) --char as a variable (character)
		plr.Chatted:Connect(function(msg) --msg as a variable (message)
			local AoS = aos:Clone()
			if plr:GetRankInGroup(SOD) >= (SoDRank) or plr:GetRankInGroup(SD) >= (SDRank) or plr:GetRankInGroup(TJC) >= (TJCRank) or plr:GetRankInGroup(ID) >= (IDRank) or plr:GetRankInGroup(CPD) >= (CPDRank) or plr:GetRankInGroup(FBIGroup) >= (FBIRank) then --if player is in these groups that was mentioned, then
				if msg == "aos ".. plr.Name then --if they said aos, then the player's name, the reason i didnt put plr.Name inside the string is because it will not work.
					AoS.Parent = char.Head --then the billboard gui parent will be the character's head if a player executed the command towards a certain player
					AoS.ImageLabel.Visible = true
				elseif msg == "revoke aos ".. plr.Name then            --|if the plr said revoke aos to a certain player, then
					AoS.ImageLabel.Visible = false --will not be visible, the reason i put a AoS.ImageLabel.Visible = true on the first if statement is to be visible again once revoked and used again to the same plr
				end
			end
		end)
	end)
end)





Sorry, I thought this was KoS. But either way, doesn’t matter lol.

1 Like

I can’t really see any issues with the code, does it stop working after you die or does it straight up never work? Might want to try adding WaitForChild, looking at the console or adding some prints.

It doesn’t removes if you died. I tried adding waitforchild in the aos part, which is the billboard gui. Doesn’t work also.

I’ll try adding some prints to know the problem, thanks for the reply.

1 Like

Here’s what to do:

  1. Declare the humanoid and make a function that happens when they are on 0 health.
  2. Then, make it so that what you would like to do, is put here.

Hope this helps! :slight_smile:

Also the names of the scripts aren’t really that clear so I recommended cleaning it up.

1 Like

Like uh, make an if statement if the humanoid health is 0, the gui parent will still be the head, is that what you meant?