How to make it so as a number goes down, another number goes up?

I was making something and Idk how to do it so as the health goes down the persons attack power goes up

We’re going to need a script to see what exactly you are trying to do. However if you want a damage variable to increase while someone’s health decreases, consider the following as a rough example:

-- Server script located in StarterCharacterScripts
local player = script.Parent 
local oldHealth = player.Humanoid.Health
local attackPower = [value location here]
local increaseAmount = 10 -- any value

-- Create a listener event to detect when a player's health changes
player.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
     -- Check if the player's health went down
     if player.Humanoid.Health < oldHealth then
          attackPower.Value += increaseAmount
          oldHealth = player.Humanoid.Health
     end
end)
1 Like