How do I fix my charge system?

I’m trying to make a charge system for my jojo game and I was wondering why it doesnt stop charging one it hits 100 and also how would I make another value go up by 1 when the charge value hits another 100.

local plr, stats, input = unpack(args)
			local char = plr.Character or plr:IsA("Model")
			local values = char.Values
			local BurstCount = values.BurstCount
			local ChargeHealth = values.ChargeHealth
			local CantCharge = false
			local keyHeld = require(MainModule.Parent.MainFunction).isKeyHeld
			if ChargeHealth.Value == ChargeHealth.Value + 100 then
				CantCharge = true
				Functions.CreateCD(plr, "G", nil, 2)
			end
			repeat
				ChargeHealth.Value += 1
				wait(stats.TickSpeed)
			until CantCharge == true or not keyHeld(plr,"G")

it’s because it’s busy with the repeat loop and can’t check the if statement.

Put the if inside the repeat

character limit

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.