I’ve been working on a GUI system where I have a health, stamina and EXP bar.
Once I finally got towards the end, I was given an error message on this part of code, saying:
attempt to concatenate string with nil
<code>HealthDisplay.Text = "HP: " .. Humanoid.Health .. "/" .. Humanoid.MaxHealth
StaminaDisplay.Text = "Stamina: " .. Stamina.Value .. "/" .. MaxStamina.Value
LvlDisplay.Text = "Lvl: " .. Level.Value
</code>
<code>HealthDisplay.Text = "HP: " .. Humanoid.Health .. "/" .. Humanoid.MaxHealth
StaminaDisplay.Text = "Stamina: " .. Stamina.Value .. "/" .. MaxStamina.Value
LvlDisplay.Text = "Lvl: " .. Level.Value
</code>
HealthDisplay.Text = "HP: " .. Humanoid.Health .. "/" .. Humanoid.MaxHealth
StaminaDisplay.Text = "Stamina: " .. Stamina.Value .. "/" .. MaxStamina.Value
LvlDisplay.Text = "Lvl: " .. Level.Value
Im not sure how to fix this.
I tried using the “tostring()” function but it would only say “nil” on the bars rather than the number.
New contributor
Bloop Icon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.