Hello scriptinghelpers, I'm here to ask a question regarding why my BillboardGui seems to re-appear after the {Player} resets, dies, or something along those lines; I have already tried using ResetOnSpawn to no avail, here's the current piece I need help with;
local function onNameEvent() playerWS.Head:FindFirstChild("BillboardGui").Enabled = false if humanoid:GetState() == Enum.HumanoidStateType.Dead then player.Character:WaitForChild("HumanoidRootPart") playerWS.Head:FindFirstChild("BillboardGui"):Destroy() end
Could you tell me why the BillboardGui re-appears inside of Workspace and doesn't get destroyed after the {Player} respawns? Thank you for any and all help.
Thanks for the response @MrLonely1221, I suppose I should've been more specific; the BillboardGui will stay above the {Player}'s head indefinitely for other users but the BillboardGui will never show up on the {Player}'s screen; a name-tag system, of sort.
Here is the code for inserting the BillboardGui into the {Player}.
local playerWS = character:FindFirstChild("Head") local localPlayer = client.Character local billboardGUI = Instance.new("BillboardGui", playerWS) local textLabel = Instance.new("TextLabel", billboardGUI) textLabel.Text = character.Name billboardGUI.ExtentsOffset = Vector3.new(0, 3, 0) billboardGUI.Size = UDim2.new(1,1, 1,1) billboardGUI.ResetOnSpawn = false textLabel.Font = "SourceSansLight" textLabel.Size = UDim2.new(5,0, 1,1) textLabel.TextStrokeColor3 = Color3.new(0, 0, 0) textLabel.TextStrokeTransparency = 0 textLabel.TextColor3 = Color3.new(255, 255, 255) textLabel.TextScaled = true textLabel.BackgroundTransparency = 1 textLabel.Position = UDim2.new(-2,0, -0.5,0)
Everything works just as I'd hope for it to.. until the {Player} resets and it ends up appearing to the {Player}, rather than only other users.
I believe you are accidentally using s client-side property of the object. Instead, I recommend this:
local function onNameEvent() playerWS.Head:FindFirstChild("BillboardGui").Enabled = false if humanoid:GetState() == Enum.HumanoidStateType.Dead then player.Character:WaitForChild("HumanoidRootPart") playerWS.Head:FindFirstChild("BillboardGui").Enabled = false end
I have had some experience with the .Enabled
function in which I wanted it to be client-side, but it was server-side, and that script was a failure, and from that, I have learnt that it's a server-side property. Thankfully, I can tell this information to you.
The Enabled
property is used to disable and enable a GUI and whatnot. I have recently found it is server-side, as I mentioned before, and it should work much better than the :Destroyed
function.
I really hope this script works, and if not, I also have my ways to go. Not everyone is perfect, so if I have made any mistakes in this, please do not be rude.