Weird TriggerClientEvent Parameter Passing For Nearly Identical Events

General Description

I experienced some weird issues regarding parameter passing when using TriggerClientEvent in Lua with one of our resources. I’ve been attempting to trigger a client event using almost the exact same parameters in two differing resources but have been experiencing a changed result in the last parameter on only one specific resource, the parameter is being changed from a true value to a nil value only on the last parameter, with all the other parameters being passed as they should be. In the other resource, the TriggerClientEvent is passing all of the correct parameters to the client event handler with no changes to the last parameter.

Not sure what is necessarily going on here and considering my recent introduction into Lua, I didn’t want to report a bug that could be caused by my ignorance.

The TriggerClientEvent call on the resource that is passing all correct parameters:

A print of the parameter received by the Event Handler on the client:

As can be seen, all the parameters are being received correctly by the event handler, with the last parameter being correctly received as true

The TriggerClientEvent call on the resource that is passing the last parameter as nil

A print of the parameters received by the Event Handler on the client:

As can be seen here, the last parameter is being received by the Event Handler as nil even though the TriggerClientEvent is passing a true boolean as its last value. All of the previous parameters are being passed correctly. This switching of the final parameter from a true to nil occurs for all of the TriggerClientEvent calls within this resource

Client Event Handler in Question

Final Note:

I could honestly just be doing something stupid here and someone just needs to let me know what’s up. If anyone needs any more information regarding the issue, I’ll be happy to provide it.

I’ve encountered similar issues where if one argument to TriggerClientEvent is nil, ALL the following arguments are set to nil when the server receives the event. This also happens the other way around where TriggerServerEvent does the same thing. I bypassed this issue by passing arguments that may have nil values in a table.

1 Like

This has been an issue for a while now, but technically it should have been fixed in Event argument turns into nil if 2 previous were nil.

A work-around for this would be to change values that require nil to “don’t use” values like false or -1 or whatever.

edit: 1yo thread… baited again