You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want it to be based on a points system that when you level up, you have points in which I raise the defense in the video and when I exit the game and re-enter my life is reset to 100/100 causing it to change again raising the defense to the one he had in the points. -
What is the issue? Include screenshots / videos if possible!
Here are the points that I have
These are the data values āāthat have to add to my life in this case 100 + 135.
https://i.gyazo.com/05e28942192160965588bde0d2060cb5.mp4
And here is the video where I teach it best
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried to take the data of my level and add it with the defense value which has not worked and I can not think of more ideas since I am a beginner in this and I took it from a tutorial
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that itās easier for people to help you!
Character = game:GetService("Players").LocalPlayer.Character
if not Character then repeat wait() until Character end
while wait() do
script.Parent.Text = math.floor(Character:WaitForChild("Humanoid").Health) .."/".. math.floor(Character:WaitForChild("Humanoid").MaxHealth)
end
This is a local script where the text of health is located in the gui
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local Data = player.Data
local Defense = Data:WaitForChild("Defense")
character.Humanoid.MaxHealth = Defense.Value + 100
character.Humanoid.Health = character.Humanoid.MaxHealth + 100
end)
end)
And this is the script where the maximum life is stored, that is, 100 / ā100ā which is in quotes. This script is located in scriptservice