What's making my bleed script crash?

I’m making a bleed script when a character takes damage. It’s parented in the starter character scripts folder. Every time I take damage the script crashes studio right away. It doesn’t throw any errors and it seems to be working from what I can tell before studio crashes. I don’t know why its crashing and I would appreciate any help.

Thank’s in advance.


repeat wait(.1) until script.Parent:FindFirstChild("Humanoid")
local cooldown = 3

coroutine.create(coroutine.resume(function()
	while true do
		local bc = 0
		
		for a, b in ipairs(script.Parent:GetChildren()) do
			if b.Name == ("Blood") then
				bc = bc + 1
			end
		end
		
		if bc > 6 then
			for i = 1, (bc-6) do
				script.Parent:FindFirstChild("Blood"):Destroy()
			end
		end
		
		wait(.1)
	end
end))

coroutine.resume(coroutine.create(function()
	while true do
		script.Health.Value = (script.Parent.Humanoid.Health)
		wait(.5)
	end
end))

script.Parent.Humanoid.HealthChanged:Connect(function()
	if script.Parent.Humanoid.Health < script.Health.Value then
		
		local LostHealth = (math.floor(script.Health.Value - script.Parent.Humanoid.Health))
		local plox
		
		if LostHealth <= (script.Parent.Humanoid.MaxHealth/6) then
		plox = 1
		elseif LostHealth <= (script.Parent.Humanoid.MaxHealth/5) then
		plox = 2
		elseif LostHealth <= (script.Parent.Humanoid.MaxHealth/4) then
		plox = 3
		elseif LostHealth <= (script.Parent.Humanoid.MaxHealth/3) then
		plox = 4
		elseif LostHealth <= (script.Parent.Humanoid.MaxHealth/2) then
		plox = 5
		else
		plox = 6			
		end
	
		
		for cycle = 0, plox do
			local Part = Instance.new("Part",script.Parent)
			Part.Name = "Blood"
			Part.BrickColor = BrickColor.new("Crimson")
			Part.Material = "Foil"
			Part.Reflectance = 0.5			
			Part.Anchored = false
			Part.Size = Vector3.new(1.5,.5,1.5)
			local density = 100
			local elasticity = 1
			local elasticityWeight = 1
			local physProperties = PhysicalProperties.new(density, elasticity, elasticityWeight)
			Part.CustomPhysicalProperties = physProperties	
			if script.Parent:FindFirstChild("UpperTorso") then
				local torso = 	script.Parent:FindFirstChild("UpperTorso")
				Part.CFrame = CFrame.new(torso.Position)
			elseif script.Parent:FindFirstChild("Torso") then
				local torso = script.Parent:FindFirstChild("Torso")
				Part.CFrame = CFrame.new(torso.Position.X + math.random(-1.5, 1.5),torso.Position.Y + math.random(-1.5, 1.5),torso.Position.Z + math.random(-1.5, 1.5) )
			else return end		
			Part.Parent = script.Parent			
			wait(1/plox)
		end
		script.Disabled = true
		wait(cooldown)
		script.Disabled = false
		
		
	end	
end)

script.Parent.ChildAdded:Connect(function(obj)
	if obj:IsA("BasePart") then
		
		for cycle = 1, 10 do
			obj.Transparency = (cycle/10)
			wait(.3)
		end 		
		
		obj.CanCollide = false

	end	
end)