i recently created this modulescript:
local module = {}
function module.onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.Space then
print("Spacebar was pressed")
if(_G.wt1 == true) then
_G.wt1 = false
_G.WelcomeText2()
elseif(_G.wt3 == true) then
_G.wt3 = false
_G.WelcomeText4()
end
end
end
return module
and it is referenced using a localscript that is placed in the players character on startup with this code:
local myModule = require(workspace.KeyHandler)
game:GetService("UserInputService").InputBegan:connect(myModule:onKeyPress())
but when this code runs I get:
attempt to call a nil value
so how can I fix this error? Thanks in advance!

1 comment
thanks, the error no longer comes up, but its not running like expected, ill make a new question for that though