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

My custom health isn't working correctly?

Asked by
Probix 80
7 years ago

I'm making a game that required me to make a custom health. I made the custom health and scripted it. But, it seems it's not working fully right.

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local humanoid = player.Character:WaitForChild("Humanoid")
local TheMathPart = humanoid.Health / (humanoid.MaxHealth)

script.Parent:TweenSize(UDim2.new(0,-215,0,10), "Out", "Sine", .5)

function CustomHealth()
    local TheMathPart = humanoid.Health / (humanoid.MaxHealth)
    script.Parent:TweenSize(UDim2.new(TheMathPart,-215,0,10), "Out", "Sine", .5)
end 

humanoid.HealthChanged:connect(CustomHealth)

The thing is that when I made the health 50%, it went down like it was suppose too. But, when the health started regenerating, it would just keep going instead of going back.

Also...when taken damage the health would move to the right, yet I wanted it to go left...if that makes sense. Basically, I want my health to start toward the right, and when taken damage it would move toward the left. Sorry if I'm confusing everybody!

Help would be very appreciated!

0
You didn't include the regenerateing health code. GoldenPhysics 474 — 7y
0
I looked through the object browser and I don't see anything about regenerateing health. Probix 80 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Line 7 should be script.Parent:TweenSize(UDim2.new(1,-215,0,10), "Out", "Sine", .5). Use a 1,not a 0 otherwise it won't display.

Ad

Answer this question