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

Why isn't this working?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I'm trying to get a hopperbin to detect when I press "e" and then fire up a script.

function onKeyDown(key) 
key:lower() 
if key == "e" then
script.Parent.Parent.bs.Disabled = false
end 


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

script.Parent.Selected:connect(onSelected)

2 answers

Log in to vote
0
Answered by
Cizox 80
10 years ago
function onKeyDown(key)
    key = key:lower()
    if key == "e" then
    script.Parent.Parent.bs.Disabled = false
end
Ad
Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
10 years ago
function onKeyDown(key) 
    key:lower() 
    if key == "e" then
        script.Parent.Parent.bs.Disabled = false
    end 
end -- Missing an end


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

script.Parent.Selected:connect(onSelected)

Answer this question