Script working once before stopping to work

Hi, I’m trying to make a script of a giant eating a person when it’s touched. but the script only works once and then stops. please help

script:

local db = true

-- This script is for the hitbox hit function for fernard. --

game.Workspace.FernandHitbox.Touched:Connect(function(hit)
	if game.Players:FindFirstChild(hit.Parent.Name) then
		if db == true then
			db = false
		if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent.Humanoid.Health >= 1 then
		if script.Parent.Docile.Value == false then

		local hrp = script.Parent.HumanoidRootPart
		local look = hrp.CFrame.LookVector
		local pos = hrp.Position
		
		local mult = look *8
		local finalpos = mult + pos
			
			if hit.Parent:FindFirstChild("HumanoidRootPart") then
				hit.Parent:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(finalpos)
				local hum = hit.Parent:FindFirstChild("Humanoid")
				hum.WalkSpeed = 0
				hum.JumpPower = 0
				hum.JumpHeight = 0
				script.Parent.Humanoid:LoadAnimation(script.Fernand_Eat):Play()
				hit.Parent:FindFirstChild("Humanoid").Animator:LoadAnimation(script.Fernand_Victim):Play()
				wait(3)
				hit.Parent:FindFirstChild("Head"):Destroy()
				hit.Parent.Humanoid:TakeDamage(math.huge)
				db = true
				print(db)				
	end
	end		
	end		
	end
	end
	end
end)

Because the function only runs once.
If you put the original function script on top then call the function below it will automatically loop each time the Touched event occurs.

1 Like

so put the script under a function and then play it inside the event?

thanks I found out what to do
I needed to switch the location of the debounce thing