Is this even possible? (Show health Value?)

The op did not provide any information of him making an IntValue, so the best solution here is using Humanoid.Health

They didn’t provide the information that they wanted to display the humanoids health either.

What ‘Health’ other than a character’s health was he wanting to display when he clearly referred to a LocalPlayer? Also this argument is beside the point. Cya

Just a value inside of the LocalPlayer from the op’s perspective it looked that way. So I was just trying to provide him with a fixed version to see if it would solve his problem. But I guess that’s not the right thing to do? Adios though

What do you think I am doing? I spend a solid 30 min looking at my scripts and online before I make a post. Then after I make a post I use the knowledge you give me for future scripts and edit those scripts because I usually don’t like how they work and I make them faster or function in a different way.

1 Like

Still does not work this might 100% be impossible. Maybe health is not a number? Maybe a %? Or something?

On a totally unrelated note, I’ve seen a lot of developers adding semi-colons ( ; ) after some lines of code, could you explain why people are doing this? Is it for cosmetic purposes?

1 Like

Not on Luau put for Python and stuff you kind of have to use them.

its a habit they inherit from programming in other language

1 Like

Ohh, I see. There’s no performance boosts by using them?

no. 30 ssssssssssssssssssssssssss, also i remember reading somewhere roblox dont recommend putting semicolons at the end of variables

1 Like

No

In Python instead of

if blah blah blah then
Blah Blah

It’s

if blah blah blah;
blah blah

But thats only one example.

I see. Thank you for taking the time to reply!

1 Like

Haha, it isn’t necessary at all! I have been coding in Java since 2019 so I just have a habbit of adding ; at the end of each lines of my code!

Side note: If you don’t add semi-colons at the end of the lines of your code in java, it will give you syntax errors, so I have this as a habbit. Many other languages also have these kind of syntax rules.

1 Like

In python they use : colons for functions, conditions, loops etc.

a = 10

if a == 10: 
   print("its 10 :sunglasses:")

Ok it works.

But maybe too welll

Error26

How would I round it?

Yep that’s why I said and other things.

Python and Luau is the only languages that I know rn.

1 Like

Back onto the topic (thanks everyone for my inquiry regarding adding semi-colons), I made a health bar a few months ago, this seemed to work for me.

LocalScript

local Players = game:GetService("Players")
local Player = Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.HealthChanged:Connect(function()
	TextLabel.Text = math.round(Humanoid.Health)
end)

Edit: Added math.round()
Thanks, wetcoder!

1 Like

You can use math.round(). That would round it off to the nearest integer.

2 Likes

Thank you

What I never knew the function math (or whatever it was) was in this language

MIND BLOWN

Now let me spend hours researching it lol.

Bye @jaipack17 thanks for the code

And thanks @Ayphic and @jaipack17 and @iam13robloxexactly for the semi-colon thing.

Bye You Guys!

1 Like