The Goal: I’m trying to detect the input from a local script and send it over to a server script via a remote event to be later looked at.
Specifically, I want to see what type of input it is, what key was pressed, etc. and I want to do all this within the server script
The Issue: Whenever I press an input, I get an error in the output attempt to index nil with ‘UserInputType’
What I’ve tried: I have tried a lot. the only thing I remember specifically is redefining variables within the function before passing the variable off.
Local Script:
--//Functions
function movementFire(input)
print(input)
print(input.KeyCode)
print(input.UserInputType)
inputRemote:FireServer(input) --//this is defined earlier in the script
end
--//Event Listeners
UIS.InputBegan:connect(movementFire)
Side note - The print functions all produce an output at this stage
Server Script:
--//Functions
function inputCipher(player, input)
print(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
print("Was Keyboard")
end
end
--//Event Listeners
inputRemote.OnServerEvent:connect(inputCipher) --//this is defined earlier in the script
Side note - at this point, the server-side print function returns nil and then gives me the error the next line
I’m really confused needless to say.
Is it just not possible to transport inputs through remote events?
Thanks in advance for any help