Sound for every letter player types

So I have this script that is supposed to make a sound play repeatedly for each letter the player chatted. Any Amount. But If I type something long it will start overlapping with the other. How can I fix it? Here is the script:

local sound = script.Sound
game:GetService("Players").PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		for i = 1,#msg do
			sound:Play()
			wait(sound.TimeLength / 2)
		end
	end)
end)

change the wait to sound.Ended:Wait()

now it won’t overlap

2 Likes