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

Any help with onKeyDown?

Asked by 8 years ago

I have a simple reload script. When I press "F" the reload sound plays.

local Tool = script.Parent


function onKeyDown(key) 
key:lower() 
if key == "f" then 

        Tool.Handle.ReloadSound:Play()
end

end 


function onSelected(mouse) 
mouse.KeyDown:connect(onKeyDown) 
end 


script.Parent.Equipped:connect(onSelected)

But when I change if key == "f" then to if key == "r" then It doesn't work... Any help?

Answer this question