Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 9 years ago

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

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

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
Ad
Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

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)
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. adark 5487 — 9y
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. Perci1 4988 — 9y
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. adark 5487 — 9y
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. Perci1 4988 — 9y

Answer this question