#How do i index the head easier

1 messages · Page 1 of 1 (latest)

woeful pebble
#

`local HealthDisplay = game.ServerStorage:WaitForChild("HealthGui")
local HealthText = HealthDisplay.TextLabel
-------------------------><CLONE DISPLAY><-----------------------------
game.Players.PlayerAdded:Connect(function(plr)
local character = plr.Character
local head = character:FindFirstChild("Head")
local humanoid = character.FindFirstChild("Humanoid")
local Display = HealthDisplay:Clone()
Display.Parent = head
local HealthText = Display:WaitForChild("TextLabel")
HealthText.Text = humanoid.Health.Value.." HP"

if humanoid.Health.Value >= 60 then
    HealthText.TextColor3 = Color3. fromRGB(99, 255, 99)
end

if humanoid.Health.Value <= 60 then
    HealthText.TextColor3 = Color3. fromRGB(255, 253, 130)
end

if humanoid.Health.Value <= 30 then
    HealthText.TextColor3 = Color3. fromRGB(255, 52, 55)
end

end)`

tribal badge
#

use waitforchild

#

actually you should use characteradded

#

instead of playeradded

woeful pebble
#

do i use both

#

like

tribal badge
#

playeradded only checks when the player joins, so if you die then your gui wont work after u respawn

woeful pebble
#

`local HealthDisplay = game.ServerStorage:WaitForChild("HealthGui")
local HealthText = HealthDisplay.TextLabel
-------------------------><CLONE DISPLAY><-----------------------------
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
local character = plr.Character
local head = character:FindFirstChild("Head")
local humanoid = character.FindFirstChild("Humanoid")
local Display = HealthDisplay:Clone()
Display.Parent = head
local HealthText = Display:WaitForChild("TextLabel")
HealthText.Text = humanoid.Health.Value.." HP"

 if humanoid.Health.Value >= 60 then
    HealthText.TextColor3 = Color3. fromRGB(99, 255, 99)
 end

 if humanoid.Health.Value <= 60 then
    HealthText.TextColor3 = Color3. fromRGB(255, 253, 130)
 end

 if humanoid.Health.Value <= 30 then
    HealthText.TextColor3 = Color3. fromRGB(255, 52, 55)
 end
end)

end)`

#

is this ok?

#

?

#

it works bro

#

but its on the rigs head not mine

#

it just cloned with my head as the parent but its position isnt on my head

#

@tribal badge Have any idea how to fix this

tribal badge
#

set the gui's adornee to be the player's head i guess

woeful pebble
#

the text label or the health gui?

mild vergeBOT
#

studio** You are now Level 4! **studio

tribal badge
#

the gui

woeful pebble
#

THAT WORKED!