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
You cant add a new proppertie to the Humanoid I think but you can add new Values though. Like this below! :
01 | game.Players.PlayerAdded:Connect( function (player) |
02 |
03 | player.CharacterAdded:Connect( function (character) |
04 |
05 | local stamina = Instance.new( "IntValue" ) --- AN IntValue is a Value that only has Whole Numbers or Integers |
06 |
07 | stamina.Parent = character ---Set The Parent for the Stamina "IntValue" |
08 |
09 | stamina.Name = "Stamina" ---Set the Name for it |
10 |
11 | stamina.Value = 100 --- Set the Value for it! |
12 |
13 | ---And Boom! Now you have your new stamina value inside your character! :D |
14 |
15 | ----Now you can refference it by saying "player.Character.Stamina" or "player.Character:WaitForChild("Stamina")" |
16 |
17 | end ) |
18 |
19 | end ) |
A simple solution might be to just put a value inside the starterCharacter folder.