How Can I Make Values Go Up In Increments Depending On Another Value

I need to change this so the :AdjustSpeed() goes up depending on the punchspeed value, I could just make if statements for each value but that isin’t very efficent. A example of this would be, everytime the punchspeed value goes up, the AdjustSpeed goes up .1 and so on. I have a really vague memory of it being something like “for i, 50” or something like that but I’m not to sure.

function module.Punch(Power, OGPower, player, Speed, Stamina, PunchBounce, PunchAnimation, StamLoss, Damage, PunchSpeed)
	
	local Punch = player:FindFirstChild("Humanoid"):LoadAnimation(PunchAnimation)
	
	if Stamina.Value <21 and Stamina.Value >15 then
		Stamina.Value = Stamina.Value - StamLoss
	end
	
	if Stamina.Value <player.IntValues.DefStam.Value - 3 then
		Stamina.Value = Stamina.Value - StamLoss - 1
	end
	
	print("MaxSpeed")
	Power.Value = Damage 
	Punch:Play()
	game.ReplicatedStorage.FightingEvents.PunchThrown:FireServer(script.Parent.Parent)
	Punch:AdjustSpeed()
	local PunchLength = Punch.Length/Punch.Speed
	module.CoolDownLength = Punch.Length
end	

I would also be able to use this system for other things like power,stam and etc.

(This Is a Snippit of Code)

You can just create a simple equation. Something like local Speed = 10 + PunchSpeed*.1 which would add add .1 speed for every PunchSpeed with a base speed of 10.

2 Likes