So I was trying to make a notification that is a question with options to answer with and what's suppose to happen is when you choose something it prints something in the output but it wouldn't work. I was using BindableFunctions and callbacks to do this. Heres the script used.
vvvvvvvvvv
local function callback(Text) if Text == "Yes" then print("Yes") elseif Text == "No" then print("No") end end local NotificationBindable = Instance.new("BindableFunction") NotificationBindable .OnInvoke = callback() game.StarterGui:SetCore("SendNotification",{ Title = "UwU Hello"; Text = "Do u like flamingo"; Icon = ""; Duration = "5"; Button1 = "Yes"; Button2 = "No"; callback0 = NotificationBindable })
Two things were wrong
You were setting .OnInvoke to the result of the callback function And two, callback0 is suppose to be Callback in the table
I also combined the OnInvoke with the function
local NotificationBindable = Instance.new("BindableFunction") NotificationBindable.OnInvoke = function(Text) if Text == "Yes" then print("Yes") elseif Text == "No" then print("No") end end game.StarterGui:SetCore("SendNotification",{ Title = "UwU Hello"; Text = "Do u like flamingo"; Icon = ""; Duration = "5"; Button1 = "Yes"; Button2 = "No"; Callback = NotificationBindable })
(If you were not to combine it you would do NotificationBindable.OnInvoke=callback)
On a side note, I HAD NO IDEA THIS EXISTED, so thanks it's pretty neat :D
My Code:
-- Local Script in StarterGui function btnClick(btn) if btn == 'Yes' then print('Yes') elseif btn == 'No' then print('No') end end notifyBindable = Instance.new('BindableFunction') notifyBindable.OnInvoke = btnClick game.StarterGui:SetCore('SendNotification', { Title = 'Question'; Text = 'This is a question. Please answer it.'; Button1 = 'Yes'; Button2 = 'No'; Duration = 5; Callback = notifyBindable; })