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

How to make someone's health gui invisible?

Asked by
wjs3456 90
10 years ago

I would like to have use a script making the nametags/health on all the people on the blue team not visible. Here is the script I used.

for i,v in pairs(game.Players:GetPlayers()) do
if v.TeamColor == BrickColor.new("Bright blue") then  
        v.HealthDisplayDistance = 0
            v.NameDisplayDistance = 0
    end
end

Thanks

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

That will make all the blue team's health and name invisible, but it will only run once. If a new player joins the blue team, the code will not run again.

I would recommend a LocalScript in StarterGui, that way whenever a player respawns the code will run.

local plr = game.Player.LocalPlayer
plr.CharacterAdded:wait()
chr = plr.Character

if plr.TeamColor == BrickColor.new("Bright blue") then
    chr.HealthDisplayDistance = 0
    chr.NameDisplayDistance = 0
end
0
Oh that was actually on accident when I copied it. Thats not the problem wjs3456 90 — 10y
0
Read it now Perci1 4988 — 10y
Ad

Answer this question