Decals going invisible when in first person?

Hey, I have a question why does this decal go invisible in first person I’m messing around with trying to make a realism flashlight but for some reason, the decal goes invisible any ideas why??

here’s a video of the problem:

NOTE: I did make a script using the local transparency modifier to try to see if the part has a local transparency modifier applied to it but it doesn’t.

2 Likes

What is the decal parented to?

1 Like

A transparent part which is parented to the character.

1 Like

Ah, there’s the issue. I’d have to look into it a bit more but setting the LocalTransparencyModifier only once doesn’t work. You’ll need to constantly set the LocalTransparencyModifier every frame. I’m not 100% if there’s a better way to do this, but updating one part each frame shouldn’t make much of a performance impact.

1 Like

Yes, you are correct but, I have already done this here is my script

localCharacter = game:GetService("Players").LocalPlayer.Character
game:GetService("RunService").RenderStepped:Connect(function()
	for key, value in pairs(localCharacter:GetChildren()) do
		if string.match(value.Name, "Flashlight") then
			value.LocalTransparencyModifier = 0
		end
	end
end)
1 Like

Is string.match giving you the results you want? I assume any parts you want to modify here are prefixed with “Flashlight” or something like that.

Does your reference to the character object stay valid?

Maybe add some basic prints to double check?

1 Like

Do you mean like this???

localCharacter = game:GetService("Players").LocalPlayer.Character
game:GetService("RunService").RenderStepped:Connect(function()
	for key, value in pairs(localCharacter:GetChildren()) do
		if string.match(value.Name, "Flashlight") then
			print(value.Name)
			print(localCharacter.Name)
			value.LocalTransparencyModifier = 0
		end
	end
end)
1 Like

Basically, yeah. It might be a good idea to use :GetFullName() so you can verify the hierarchy location as well.

1 Like

Because the decal is parented to a part, you will need to search all descendants for it, not just children.

Try replacing this line:
for key, value in pairs(localCharacter:GetChildren()) do
with this:
for key, value in pairs(localCharacter:GetDescendants()) do
and see if that helps.

Alternatively, perhaps your hierarchy can be set up in a way that does not require parenting the part to the character. What goal does this decal serve? Is it possible to achieve that effect with a GUI?

1 Like

Unfortunately, I am trying some new technique or at least I think a new technique that will allow me to project flashlight lines on a spotlight using a decal.

I was asking around over here about it:

and get descendants fixed it thank you I dont know why I put that there earlier.

1 Like