Custom typing sound in MessageBox

What do you want to achieve?

In creating my suggestion box for my upcoming game, I had thought of making it so that, when you are typing, a typing sound would play for each letter.

What is the issue?

The sound does not play for each key I press.

What solutions have you tried so far?

MessageBox:GetAttributeChangedSignal"ContentText":Connect(function()
	Sounds.Type:Play()
end)
MessageBox.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		Sounds.Type:Play()
	end
end)

Neither work. Am I specifying something incorrectly? Where should I put the “play sound when typing”?

1 Like

Try using the :GetPropertyChangedSignal() function and use the TextLabel’s Text property in the parentheses, then play your sound inside the function.

3 Likes

It doesn’t work too. I’m dealing with a problem in a TextBox.

1 Like

I found it! The problem is that I’m getting the attribute instead of the property. I really should read more carefully next time and panic the least often that I can.

MessageBox:GetPropertyChangedSignal("Text"):Connect(function()
	local sound = Sounds.Type:Clone()
	sound.Parent = MessageBox
	sound:Play()
	Debris:AddItem(sound,sound.TimeLength)
end)
1 Like