Script not running after parent is cloned [SOLVED]

Sorry, I made a mistake in the previous script.

Here is the updated one, which uses coroutine.create() instead of creating a new script.

-- Get the humanoid object
local humanoid = script.Parent.Parent:WaitForChild("Humanoid")

-- Define the function to generate rings
local function generateRings()
	local ring = script.ring:Clone()
	ring.Parent = script.Parent.Parent
	ring.CFrame = humanoid.RootPart.CFrame
	ring.Rotation = Vector3.new(math.random(1, 90), math.random(1, 90), math.random(1, 90))
	ring.Anchored = false
	ring.CanCollide = true
        
    --Create Script for Ring
	coroutine.resume(coroutine.create(function() 
		-- Wait for the parent and grandparent to load before running the script
		repeat wait() until ring:IsA("Model") --// Change if Ring IsA MeshPart or something

		-- Blink effect to simulate the ring disappearing
		for i = 1, 4 do
			ring.Transparency = 1
			wait(0.1)
			ring.Transparency = 0
			wait(0.1)
		end

		ring:Destroy()
	end)) 
	
end

-- Connect the Touched event to detect when the character is hit
humanoid.Touched:Connect(function(part)
	if part.Name == "Hurt" or part.Name == "hurt" then
		part.Name = "hirt"
		local playerGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
		if playerGui.rings.Value > 0 then
			if playerGui.rings.Value <= 15 then
				for i = 1, playerGui.rings.Value do
					generateRings()
				end
			else
				for i = 1, 15 do
					generateRings()
				end
			end
		end
		playerGui.rings.Value = 0
	end
end)