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

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

Asked by 2 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

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
Can you show the full code? sngnn 274 — 2y

Closed as Non-Descriptive by JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

3 answers

Log in to vote
0
Answered by 2 years ago

When answering, if your answer does not fully solve the question, it should be written as a comment to the question instead of as an answer.

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!

Ad
Log in to vote
0
Answered by
A_Mp5 222 Moderation Voter
2 years ago

When answering, if your answer does not fully solve the question, it should be written as a comment to the question instead of as an answer.
    local snailhealth =Workspace:WaitForChild("snail"):WaitForChild("Humanoid").Health
Log in to vote
0
Answered by 2 years ago

When answering, if your answer does not fully solve the question, it should be written as a comment to the question instead of as an answer.

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.