SendNotification - Detecting what the player has clicked

I’d like to detect if the player has clicked on Button1 or Button2 in a coregui notification.
image

I’d also like to know what I should do to properly create the callback function if I need it. Thanks for reading!

2 Likes

You need to make a BindableFunction as the callback, and make a function when the BindableFunction is invoked.

local StarterGui = game:GetService("StarterGui")
local BindableFunc = Instance.new("BindableFunction")

BindableFunc.OnInvoke = function(args)
	print("You chose: " .. args)
end

StarterGui:SetCore("SendNotification", {
	Title = "Question",
	Text = "How are you doing?",
	Duration = 10,
	Callback = BindableFunc,
	Button1 = "Good",
	Button2 = "Bad"
})

Hope this helps!

2 Likes