Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't this working?

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

function onKeyDown(key)
	key = key:lower()
	if key == "e" then
	script.Parent.Parent.bs.Disabled = false
end
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)

This discussion is preserved as it was. New answers, comments, and votes are closed.