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

Humanoid new "health" energy or stamina?

Asked by 5 years ago

I want to create and assign a variable (Energy) to the humanoid by Script like a (Health). e.g.: Energy / Humanoid / Player

Is possible without Script, however is not displayed in "Game" in the Humanoid object. • Create a variable in StarterGui • Create a variable in StarterPack • Create a variable in StarterPlayer

It's possible? Any suggestion?

Is it possible to create a variable for the Humanoid object per instance?

humanoid = Instance.new ("Humanoid")

(I do not know how it works)

I already spent 10 hours of research and I did not find anything

0
Dont Assign Anything to the Humanoid, Create either new bool Values or intValues within the character. Tizzel40 243 — 5y
0
That's what he thought. In the Humanoid documentation there is nothing to talk about this compared to the objects and properties. Either way, how variables can improve practice. Thanks for sharing! SagataGames 5 — 5y

2 answers

Log in to vote
1
Answered by
Tizzel40 243 Moderation Voter
5 years ago
Edited 5 years ago

You cant add a new proppertie to the Humanoid I think but you can add new Values though. Like this below! :

game.Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function(character)

local stamina = Instance.new("IntValue")--- AN IntValue is a Value that only has Whole Numbers or Integers

stamina.Parent = character---Set The Parent for the Stamina "IntValue"

stamina.Name = "Stamina"---Set the Name for it

stamina.Value = 100 --- Set the Value for it!

---And Boom! Now you have your new stamina value inside your character! :D

----Now you can refference it by saying "player.Character.Stamina" or "player.Character:WaitForChild("Stamina")"

end)

end)
0
That does not work... DeceptiveCaster 3761 — 5y
0
Why wouldn't that work? I suppose if the op wanted the property inside of the humanoid you could make stamina's parent inside of humanoid instead of character..? Troidit 253 — 5y
0
It does work dude, roblox thinks only his way works because he has 1k points. That being said, he would still need to add more code cmgtotalyawesome 1418 — 5y
0
^ seems to think* cmgtotalyawesome 1418 — 5y
0
Thanks Tizzel40 i ll try to use this code. SagataGames 5 — 5y
Ad
Log in to vote
1
Answered by 5 years ago

A simple solution might be to just put a value inside the starterCharacter folder.

1
i agree CjayPlyz 643 — 5y
0
That's it. As I mentioned, it is possible. But goal was via Script. SagataGames 5 — 5y

Answer this question