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

Local sound key detection script?

Asked by 9 years ago
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.KeyDown:connect(function(Key)
    if(Key:lower() == "m") then
        script.Parent.Command1:Play()

I am attempting you make this so that in the battlefield you don't have to type certain things, such as you can just hit "m" and your guy will shout "I need ammo over here". Only problem I am having if the script wants me to throw a end in at the bottom of the script, Plus i wonder if it can work with a local script which i have it in now..

Thanks

2 answers

Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

First of all, great idea. Second, from the code you posted, you are missing ends. You need to put in an end and end) respectively.

EDIT: For LocalScripts to work, they must be directly in or a descendant of StarterPack or StarterGui.

Ad
Log in to vote
0
Answered by 9 years ago

Still doesn't work :/

0
I edited my answer. Please see if it works yumtaste 476 — 9y
0
I believe that the ends are cutting off the audio from being played. StevenRedhart 5 — 9y

Answer this question