Trying to fix the grab script that enemies in my game uses, when player is grabbed, it's supposed to deal damage per second (haven't solved yet)

hello there yet again, I’m currently making an rpg game with some kits, and I have stumbled across the problem with script that makes enemies in the game grabs you and it’s supposed to deal damage over seconds but that part isn’t working. let me show you the script code.

----------------------------
_G.timedamageonscreen = 4
cooldown = 14
DamageAmount = 11
_G.damageMessage = "NUU!! :(("
_G.Messageofdamage = DamageAmount.." Damage points have been dealt to your health, Sorry! ;(" --I am not using this line, so please ignore.
----------------------------
debounce = true
script.Parent.Touched:connect(function(plyr)
	if debounce == true then
		debounce = false
		local person = plyr.Parent
		if person:FindFirstChild("Humanoid") then
			local nam = person.Name
			person:FindFirstChild("Humanoid").Health = person.Humanoid.Health - DamageAmount
			while script.Parent.Occupant == true do --it's supposed to repeat giving player who sat on damage per second, but it's not working and I do not know how to fix it.
				person:FindFirstChild("Humanoid").Health = person.Humanoid.Health - 12
				repeat wait(1) until script.Parent.Occupant == false
			end
		wait(cooldown)
			debounce = true
		end
	end
end)

and if you have read those all and willing to help me out, I will be pleased to helped. thank you so much. I hope project you’re also working on goes well.
-mari

if you are using seats, the property Occupant will not be true or false, it will instead be set to a player’s character or nil. the code should look like this

while script.Parent.Occupant do
	person:FindFirstChild("Humanoid").Health = person.Humanoid.Health - 12
	repeat wait(1) until not script.Parent.Occupant
end

also,

person:FindFirstChild("Humanoid").Health = person.Humanoid.Health - 12

can be turned into

person:FindFirstChild("Humanoid").Health -= 12

it is called incrementing and decrementing.

local number = 1
number += 2 -- is same as variable = variable + 2
number -= 2 -- is same as variable = variable - 2
number *= 2 -- is same as variable = variable * 2
number /= 2 -- is same as variable = variable / 2

looks like this

thank you for your generous help, but however, the script isn’t dealing damage per second while player sat on the seat, so it would be awesome if you could fix it further, thank you
here is the current code.

----------------------------
_G.timedamageonscreen = 4
cooldown = 14
DamageAmount = 11
_G.damageMessage = "NUU!! :(("
_G.Messageofdamage = DamageAmount.." Damage points have been dealt to your health, Sorry! ;("
----------------------------
debounce = true
script.Parent.Touched:connect(function(plyr)
	if debounce == true then
		debounce = false
		local person = plyr.Parent
		if person:FindFirstChild("Humanoid") then
			person:FindFirstChild("Humanoid").Health = person.Humanoid.Health - DamageAmount
			while script.Parent.Occupant do
				person:FindFirstChild("Humanoid").Health -= 10
				repeat wait(1) until not script.Parent.Occupant
			end
		wait(cooldown)
			debounce = true
		end
	end
end)

tell me if there is something wrong with the script. -mari

hello there, I’m wondering if you could still respond to me, I understand that it takes time to get an solution but somebody could help me with it?
-mari

i was going to help you but i forgot to help you