Hello,
I am trying to send my module script object the parameters from the input began event, of the UserInputService
https://gyazo.com/c0551f9596420401fabbe95042238178
https://gyazo.com/787899de0e3cb109f58855984d074f66
But when I try to run the code, it outputs and errors saying that the input object parameter is a boolean,
and the isGameProcessed parameter is nil
https://gyazo.com/3a40ee84ca77beed8147fc915d735b58
It seems pretty clear that 1parameter is being lost somewhere
https://gyazo.com/178d452bc2d94278c11f99826b2b23a5
for an easy fix but I just wanted to know why a parameter was getting lost.
Could anyone help me please.
Tomarty
(Tomarty)
August 8, 2019, 1:26pm
#2
Change it to
function greedyInputService.InputBegan(inputObject, isGameProcessed)
The colon* is syntactic sugar for this:
function greedyInputService.InputBegan(self, inputObject, isGameProcessed)
8 Likes
As I remember correctly there’s difference between : and . when you call function. one passes self as first parameter and one doesn’t(but you can still use it without passing it). Because your inputBegan in module script is not service function, probably that’s changing the layout of arguments and that results in that error
posatta
(pasta)
August 8, 2019, 5:36pm
#4
Tomarty:
The semicolon
That’s just a colon. A semi-colon is ;
.
4 Likes
Tomarty
(Tomarty)
August 9, 2019, 6:37am
#5
Oops! I posted that a few minutes after waking up so I shouldn’t be surprised.
1 Like