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)
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.
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)
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.