Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How are you able to make names and health bars disappear, but only behind walls?

Like if someone was standing in front of a wall, you can see their name. But if they were behind the wall, you couldn't.

2 answers

The NameOcclusion Property is exactly what you are looking for.

In a LocalScript in the StarterGui:

local plr = Game.Players.LocalPlayer
(plr.Character or plr.CharacterAdded:wait()):WaitForChild("Humanoid").NameOcclusion = Enum.NameOcclusion.OccludeAll

Adark is right, but his code results in an error. Do this instead:

from a server script in workspace

game.Players.PlayerAdded:connect(function(plr)
	(plr.Character or plr.CharacterAdded:wait() ):WaitForChild("Humanoid").NameOcclusion = Enum.NameOcclusion.OccludeAll
end)

4 comments

0

Actually, there is a simple Property, which I posted in my answer, that achieves the effect OP desires that doesn't involve anything other than setting said property. SmoothBlockModel's problem was detecting if a Player was looking in a specific direction and could 'see' the Angel's model.

0

No, that property is used to make it so other player's cannot see your healthbar and name. It does not make it so you cannot see their health bar when they are behind a wall.

0

Try using the script I posted as a LocalScript in StarterGui. Trust me, that's the property they want to use. Don't believe what the property description says, it's not entirely correct.

0

Well you're right about that property... (the wiki lied :o) But your code is underlined in red.I edited my answer with a script that I tested and it works.

This discussion is preserved as it was. New answers, comments, and votes are closed.