this is my current script. so my idea is that if you press f on the keyboard, it will play a sound but it doesn't work. I put this code in a local script and put it into startercharacterscripts.
repeat wait() until game.Players.LocalPlayer m = game.Players.LocalPlayer:GetMouse() m.KeyDown:connect(function(key) if key == "f" then local Sound = Instance.new("Sound", game.Workspace) Sound.SoundId = "187137639" Sound:Play() end end)
KeyDown is deprecated. Also you can't do the sound id "187137639" it must be "rbxassetid://187137639". Please refer to http://wiki.roblox.com/index.php?title=Keyboard_input But here is a fixed script.. And also the repeat wait is not necessary..
function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.F then local Sound = Instance.new("Sound", workspace) Sound.SoundId = "rbxassetid://187137639" Sound:Play() end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)