Bug with disabling Billboards. [SOLVED]

What do you want to achieve?
I have a working script that goes through the player’s head and disables billboard tags (for only you) I made so that when you’re in first person you can’t see them when you run. Tags are auto-assigned in another script which works perfectly fine. (Yes the game is locked in first person)

What is the issue?
So for some unknown reason. This script doesn’t seem to work for my alternate accounts (for testing and whatnot) but it works with my friend’s account, others and mine perfectly fine. Why is this happening? Also the output prints “Got Var” but doesn’t print “Connected” like the other accounts. (There are also no errors with the alt accounts.) It’s like the :Connect(function() doesn’t connect.

What solutions have you tried so far?
I have rewrote the script several times and it still won’t work for those accounts but will for others. No one has had this issue as far as I’m aware. Now I don’t really care since these accounts are for “Testing” purposes but I do want to know why this happens, if anyone knows why then I would love to know.

I also gave these alternate accounts perms to edit the game so I could see if it worked in studio and sure enough it did. With both of them! but in the app, it doesn’t seem to work.

Here’s the script. You can use it if you want (this goes into starter character scripts)

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild('Head')

print("Got Var")

	if head.LocalTransparencyModifier == 1 then
		if head:FindFirstChild("Tags") then
			head.Tags.Enabled = false
			print("DISABLED TAGS")
				print("Cant Find Tags")
		if head:FindFirstChild("DevTag") then
			head.DevTag.Enabled = false


			print("Cant Find Dev Icon")
		if head:FindFirstChild("TesterTag") then
			head.TesterTag.Enabled = false


			print("Cant Find Tester Icon")
		if head:FindFirstChild("Spec") then
			head.Spec.Enabled = false

			print("Cant Find Spec Icon")

			print("Cant Find Special Icon")

While I’m unsure of why it would only be working for some players and not others, a possible solution that could avoid encountering any inconsistencies would be to remove that event entirely.

Since the Character’s head already exists by the time the first print statement runs, and you mentioned that the game is locked in first-person, there shouldn’t be a need to detect when its LocalTransparencyModifier property changes since the player would not be able to decide when to enter or leave first-person mode in the first place, and there could be a chance that the event isn’t connected to the event before the player is forced into first-person mode and the value of LocalTransparencyModifier changes.

Here’s a possible revision that also helps to cut down on the amount of code at the same time:

Example Revision

-- LocalScript would still be placed in StarterCharacterScripts
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()

local Head = Character:WaitForChild("Head")

local function locallyDisableBillboardGuis(item)
    if item:IsA("BillboardGui") then
        item.Enabled = false


for _, item in Head:GetChildren() do
1 Like

I typed a code out similar to this and it worked. Since I’m new to scripting still, obviously imma make the code a giant block of if statements lol.

I tried finding other ways to get the player’s head but couldn’t, so I went with that. I’m not sure why it wouldn’t work for the alts though. Super odd, I’ll mark this as the solution, thanks for helping me!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.