What does a script look like that when a hot key is pressed e.g âkâ, a sound is played but it is a local sound that is emitted from the player?
You would need to add a Sound object to the player.
use UserInputService to get when the player presses a key, then play the sound.
sound = WhereEverTheSoundIs function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.(whatever) then sound:Play() end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Accept farizarps' answer lol, ours are both basically the same, I didn't include "gameProcessedEvent" because I thought it was pointless if it aint used in a function.
Well to get keybinds, you need a localscript, so the local sound part is already covered. Unless what you mean by that is a sound that is played GLOBALLY (heard by everyone) and not just for the player.
UIS = game:GetService("UserInputService") -- UserInputService local audio = whereversoundis UIS.InputBegan:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.R -- Change R to whatever key audio:Play() end end)
I've never personally ever used keys, so I just copied & rewrote from the wiki: https://developer.roblox.com/articles/Keyboard-Input-Methods