Hello everyone,
I’m working on a generic dialog system, so basically I have a ModuleScript that takes:
function NPCDialogue.openDialog (player, npcImage, npcName, npcSpeak, options)
Now, the last argument (options) was designed to be a table with an structure like this:
local options = { { 'Hello', HelloFn }, { 'Close', CloseFn }}
In short it’s an array of buttons, each element in this array would also be an array containing the button label and a callback function.
To define my callbacks, I’m doing something like this:
local HelloFn = Instance.new('BindableFunction')
HelloFn.OnInvoke = function ()
print('Hello'
end
If I try to print options[1][2] on the script where I’m defining options I get a function as result, but inside my Module Script method options[1][2] is equal to nil.
First thing, I’m not sure if it’s the right way to do, but if it is, then what am I doing wrong?
If not, how am I supposed to do it?
Thanks in advance.
EDIT - May be relevant:
I’m firing an event that is captured by a local script
evtOpenNPCDialogue:FireClient(player, npcImage, 'npcName', 'npcText', options)
When I try to print options[1][2] on my local script the response is also nil.