[UNSOLVED] Weird bindable event behavior

I have a very simple local script that fires a bindable event to another local script:

image

image

The issue is that any index that isn’t “command” or “id” is not received in the other script.
(To add on if I include a numerical index the “id” index is also not received)
I don’t have any if statements or anything like that which could be causing this to happen.
Here is one such example of this:
image

If you are using a BindableEvent, you should listen to it as

yourBindableEvent.Event:Connect(function(...)
    -- Your stuff here.
end)

However, if you are using a BindableFunction, you should register a callback like the following

yourBindableFunction.OnInvoke = function(...)
    -- Your stuff here.
end

Please, note how the BindableEvent class provides two methods: BindableEvent::Fire and BindableEvent::Connect, while the BindableFunction class provides a method and a callback, respectively: BindableFunction::Invoke and BindableFunction::OnInvoke.

I do believe that the behavior you are looking for should be one of these:

-- If a BindableEvent
GuiControl.Event:Connect(function(var)
    if var.command == "close" then
    elseif var.command == "insert" then
    elseif var.command == "remove" then
        delay(0, function() wait() print(var) end)
    .
    .
    .
end)

-- If a BindableFunction
GuiControl.OnInvoke = function(var)
    if var.command == "close" then
    elseif var.command == "insert" then
    elseif var.command == "remove" then
        delay(0, function() wait() print(var) end)
    .
    .
    .
end

Best regards,
Octonions

1 Like

oh sorry :sweat_smile:
I didn’t realize it was a bindable function as someone else wrote that code
I just assumed that it was an event

I’ll keep this in mind thank you.
Any idea on the index disappearing though?

1 Like

There are some remote limitations explained in this documentation.

Maybe they can explain something?

I’m passing dictionaries with no numerical indexes so I don’t think it’s that.

Hello again.

The reason behind indices disappearing might be because you are sending metatable data too. Make sure you are not. :wink:

Best regards,
Octonions

Could you please elaborate on the “metatable data” part and state specifically what I am passing that qualifies as metatable data?
Because I am not using metatables whatsoever or even mentioned them at all.

I do believe the reason behind the index quantity disappearing is because it might be set to nil. Maybe you can check before calling the event?

If you look up at the original post, you’ll see I have two images. The top image being the value of the table printed before it is sent, and the value of the table after it is sent in the bottom table. Now, if you look real closely at the top image, you see a key named “quantity”. If you look to the right of the key you can see “2”, which is clearly not nil.

Not really sure what is going on then. Maybe you can testing in a different place or, even, make your own system to broadcast that type of information, which is what I would do if I was in a similar situation.