Audio doesn't turn off when player exits the part

local playing = false
local sound = workspace.Folder.Sounds:WaitForChild("BaseSound")

workspace.Folder.Obby.Start:WaitForChild("BaseStart").Touched:Connect(function(hit)
	if hit.Parent and hit.Parent:FindFirstChild("Humanoid") and not playing then
		playing = true
		print("Playing sound")
		sound:Play()
		sound.Ended:Wait()
		playing = false
	end
end)

workspace.Folder.Obby.Start.BasePart.HumanoidExited:Connect(function(hit)
	if hit.Parent and hit.Parent:FindFirstChild("Humanoid") and playing then
		playing = false
		print("Stopping sound")
		sound:Stop()
	end
end)

Local script. Inside StarterPlayerScripts

What is HumanoidExited?

Don’t you mean TouchEnded?

It still doesn’t work. I do not know why.

Do “Playing Sound” and “Stopping sound” print each time you enter/exit the Part?