Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I put my humanoid's health into a variable, so why does it return nil?

I'm trying to get my humanoid's health into a variable so i can put it into a text box.

snailhealth = game.Workspace.snail.Humanoid.Health

but here's the issue... It keeps returning nil.

1 comment

1

Can you show the full code?

3 answers

Hello! I dunno how much experience you got in scripting and UI work, but I'm bad in UI work. So I mostly search for videos how to do it, and maybe edit it how I like it. I often use videos like this: https://www.youtube.com/watch?v=5J75rouuh7A Of course you don't have to do it 1:1 by him but you could get some inspiration's to the solutions there!. Wish ya a great day!

	local snailhealth =Workspace:WaitForChild("snail"):WaitForChild("Humanoid").Health

Happens to me many times. What I would do is, when changing the health, you should directly call it, like this.

Humanoid.Health = 100

Using a variable on Humanoid does some strange stuff. I personally wouldn't assign a variable to a Humanoid attribute.

This discussion is preserved as it was. New answers, comments, and votes are closed.