I tried this but it doesn't work, only works in solo mode in studio. I tried it online, it gives me no errors either. And it's in a local script in the Starterpack
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
local char = player.Character
while true do
local humanoid = char:FindFirstChild("Humanoid")
if humanoid ~= nil then
local bar = script.Parent
bar.Size = UDim2.new(- humanoid.Health*-0.006, 0, 0.2, 0) ---Multiplyed it by .006 since total length is .6 and the player has 100 health points.
end
wait()
end

1 comment
I tried those, the parenting is right. Idk why it didn't work, but I figured it out. Thanks.