So I have a consume system that heals the player when they click on a text-button. The player is healed the amount of health in a value called 'consume'. I am trying to make it hunger instead of healing meaning I am trying to make it so when the player clicks consume the player's hunger value goes up instead of their health value. ps: sorry if my English isn't so good (both hunger and consume are intvalues)
--(healing script) --Main script (server script) I am trying to swap
elseif Type == "Consume" then
table.remove(Player_Data, Index)
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
if Humanoid.Health < Humanoid.MaxHealth then
Humanoid.Health = Humanoid.Health + Data.Options.Consume
end
end
break
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--(hunger script local script)
local Plr = game.Players.LocalPlayer
local HungerVal = Plr:WaitForChild("HungerVal")
HungerVal.Value = HungerVal.Value + 70
if HungerVal.Value >100 then
HungerVal.Value = 100
end

3 comments
I was wondering how I change health to hunger so instead of humanoid.health it would be something like hunger.value and thank you for the reply you always help me out.
You can't really re-name Humanoid properties. You can have a IntValue inside of the player and set that value to their health and name that has Hunger and use that as your Health/Hunger variable.
that's a good idea but i wouldn't know how to execute it