The name works but the health bar does not, Any help? Here's what i did to the script if it helps local human = script.Parent:FindFirstChild("Humanoid") local hideBarAtFull = false human.HealthChanged:Connect (function(newHealth) local maxhp = human.MaxHealth if maxhp then if newHealth == maxhp then if hideBarAtFull then script.Parent.Visible = false end script.Parent.Frame.Size = UDim2.new(1,0,1,0)
elseif newHealth < maxhp and newHealth > 0 then script.Parent.Frame:TweenSize(UDim2.new(newHealth/maxhp,0,1,0), "Out", "Quad", .25) script.Parent.Visible = true
else script.Parent.Frame.Size = UDim2.new(0,0,1,0) script.Parent.Visible = true end end end) here's the other script -- Health Bar Script -- local human = script.Parent:FindFirstChild("Humanoid") -- Change this to false if you want the health bar to be visible even when the player's health is full. -- If you leave it true, the health bar will disappear when the health is full. local hideBarAtFull = false human.HealthChanged:Connect(function(newHealth) local maxhp = human.MaxHealth if maxhp then if newHealth == maxhp then if hideBarAtFull then script.Parent.Visible = false end script.Parent.Frame.Size = UDim2.new(1,0,1,0) elseif newHealth < maxhp and newHealth > 0 then script.Parent.Frame:TweenSize(UDim2.new(newHealth/maxhp,0,1,0), "Out", "Quad", .25) script.Parent.Visible = true else script.Parent.Frame.Size = UDim2.new(0,0,1,0) script.Parent.Visible = true end end end) -- Script in StarterCharacterScripts -- -- Change this line to true if you want the player to be able to see their own health bar. local showOverLocalPlayer = true -- Changes the seed. math.randomseed(tick()) local colors = script.Colors:GetChildren() local color = colors[math.random(1,#colors)] local char = script.Parent local player = game:GetService("Players"):GetPlayerFromCharacter(char) local gui = script.Display -- Moves the GUI to the player's head, makes it so the player can't see it, -- and sets it up. gui.Parent = char.Head if not showOverLocalPlayer then gui.PlayerToHideFrom = player end gui.Frame.Script.Disabled = false gui.PlayerName.Text = script.Parent.Name gui.PlayerName.TextColor3 = color.Value -- Hide old player name. char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None script:Remove()
I love you! Thank you so much for this tutorial :D
Thank you! Now I know how to make my Gui don't look garbage! :D
Can I please have the project files to his tutorial.
The name works but the health bar does not, Any help?
Here's what i did to the script if it helps
local human = script.Parent:FindFirstChild("Humanoid")
local hideBarAtFull = false
human.HealthChanged:Connect (function(newHealth)
local maxhp = human.MaxHealth
if maxhp then
if newHealth == maxhp then
if hideBarAtFull then script.Parent.Visible = false end
script.Parent.Frame.Size = UDim2.new(1,0,1,0)
elseif newHealth < maxhp and newHealth > 0 then
script.Parent.Frame:TweenSize(UDim2.new(newHealth/maxhp,0,1,0), "Out", "Quad", .25)
script.Parent.Visible = true
else
script.Parent.Frame.Size = UDim2.new(0,0,1,0)
script.Parent.Visible = true
end
end
end)
here's the other script
-- Health Bar Script --
local human = script.Parent:FindFirstChild("Humanoid")
-- Change this to false if you want the health bar to be visible even when the player's health is full.
-- If you leave it true, the health bar will disappear when the health is full.
local hideBarAtFull = false
human.HealthChanged:Connect(function(newHealth)
local maxhp = human.MaxHealth
if maxhp then
if newHealth == maxhp then
if hideBarAtFull then script.Parent.Visible = false end
script.Parent.Frame.Size = UDim2.new(1,0,1,0)
elseif newHealth < maxhp and newHealth > 0 then
script.Parent.Frame:TweenSize(UDim2.new(newHealth/maxhp,0,1,0), "Out", "Quad", .25)
script.Parent.Visible = true
else
script.Parent.Frame.Size = UDim2.new(0,0,1,0)
script.Parent.Visible = true
end
end
end)
-- Script in StarterCharacterScripts --
-- Change this line to true if you want the player to be able to see their own health bar.
local showOverLocalPlayer = true
-- Changes the seed.
math.randomseed(tick())
local colors = script.Colors:GetChildren()
local color = colors[math.random(1,#colors)]
local char = script.Parent
local player = game:GetService("Players"):GetPlayerFromCharacter(char)
local gui = script.Display
-- Moves the GUI to the player's head, makes it so the player can't see it,
-- and sets it up.
gui.Parent = char.Head
if not showOverLocalPlayer then gui.PlayerToHideFrom = player end
gui.Frame.Script.Disabled = false
gui.PlayerName.Text = script.Parent.Name
gui.PlayerName.TextColor3 = color.Value
-- Hide old player name.
char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
script:Remove()
Thank you so much!
What do you put in the Custom Health script
Great video!
Hey, does this still work?
@@Rrrrry123 thanks
Amazing tutorial - just what I needed and worked perfectly. But I'm afraid you don't spell colour the proper way! :)
I believe it's American English and British English that spells words differently? Correct me if I'm wrong.
it's spelled correctly.
@@be-gau_tv2941 I was being sarcastic. For this very reason.