--chr.PrimaryPart:WaitForChild("Died"):Destroy()

local folder = script:WaitForChild("Sounds")
local soundsDes = folder:GetChildren()
for i = 1, #soundsDes do
	maxLines = #soundsDes
end

local canPlay = true
local function died()
	local ranNo =  math.random(1, maxLines)
	local str = tostring(ranNo)
	
	folder[str]:Play()
	
	if folder[str]:FindFirstChild("Effect") then
		local effect = folder[str].Effect
		local clone = effect:Clone()
		clone.Parent = chr.PrimaryPart
		clone.Disabled = false
	end
end

chr:WaitForChild("Humanoid").Died:Connect(died)
