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

How to make boolean values in StarterCharacterScripts only true when a player has done a task?

Asked by 5 years ago

I am trying to make a shop system that you can buy health in that will persist even after death. To save the health after it has been bought, I am using boolean variables in StarterCharacterScripts with names like "H500" to represent the health. There is then a script that checks if one of these variables is true, and sets the player's health to the proper value.

local GO = true

while wait(1) and GO == true do
    GO = false
    if script.Parent.H500.Value == true then
        script.Parent.Humanoid.MaxHealth = 500
        script.Parent.Humanoid.Health = 500
        print("500")
        break
    else
        print("100")
        break
    end
end

This is the script in StarterCharacterScripts that checks for one of the values (H500) being true. I have yet to establish the others, as I would like it to work fully as intended before continuing. When the player dies, the values are put back into the player as false, because that is how they are set to begin with in StarterCharacterScripts. I want a way for a specific player who has bought health to have these values persist in them (Or some entirely different way of buying and saving health)

Answer this question