local character = "bababooey"
event_characterHit:FireServer(character);
Script:
local args = RS.Combat.Events["Character Hit"].OnServerEvent:Wait()
local var_1 = args[1] --should return client's player (iUnEarthly)
local var_2 = args[2] --should return "bababooey"
Instead, all I’m getting is this error on the “var_1” line.
1 is not a valid member of Player "Players.iUnEarthly"
What am I missing? I thought :Wait() was supposed to return the parameters of the called event? Right now it only looks like it’s returning the default “player” param from OnServerEvent.
Is there a way to bypass not being able to return values from Connect:() or a way to return a value from a double nested connect event function? Like a ‘return return x’? Otherwise, I’m stuck with :Wait() and this issue.
There’s GOT to be a way to do this securely. Help, please! It’s also late and I’m burned out, so it’s possible that I’m missing something obvious.
You’re only assigning one variable, RBXScriptSignal:Wait returns the event arguments as a tuple.
You can use multiple assignment to get the additional parameters.
local Player, Param1, Param2 = <RBXScriptSignal>:Wait()
If you have variable arguments, you can pack them.
local Arguments = table.pack(
<RBXScriptSignal>:Wait()
)
local Player = table.remove(Arguments)
Keep in mind that RBXScriptSignal is the RemoteEvent’s OnClientEvent property.