Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When player types, how do every letter play a sound?

Asked by 4 years ago
Edited 4 years ago

So I see many games with that, whenever your player types, every letter has a sound effect like a typewriter. But I can't seem to replicate it. Any help will be great!

This: https://www.youtube.com/watch?v=wtpi5iuxJd8

1 answer

Log in to vote
0
Answered by
exobyteXL 290 Moderation Voter
4 years ago
Edited 4 years ago
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(k)
if UIS:GetTextBoxFocused() then
script.Sound:Play()
end
end)

Make this a LocalScript with a Sound named Sound parented to it.

EDIT:

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(k)
if k.KeyCode == Enum.KeyCode.Enter then
for i = 1, string.len(UIS:GetTextBoxFocused().Text) do
script.Sound:Play()
wait(0.1)
end
end
end)
0
It worked a different way than I was expecting... suppercooolboy 4 — 4y
0
It worked differently as I expected, but it works. I was expecting on when the player entered the chat, then it would play the sound depending on how many letters the player typed. suppercooolboy 4 — 4y
0
Okay, I'll add a version for what you need. exobyteXL 290 — 4y
Ad

Answer this question