Hello. I would like to know how the buttons on the notifications work. I don’t really know how they work, and I’d like to know. I’ve tried looking for a tutorial or a solution on the dev forum, but I couldn’t find one.
This is what I have tried so far, but the Callback part doesn’t really work.
game.StarterGui:SetCore("SendNotification", {
Title = "hmm?";
Text = "?";
Duration = "300";
Button1 = "YES";
Button2 = "ew no";
Icon = "rbxassetid://7635712200";
Callback = print("e")
})
Thanks,
-Ham
2 Likes
Kaid3n22
(Kaiden)
October 11, 2021, 11:23pm
#2
You need to have a Callback function and a Bindable Event.
function Callback(answer)
print("e")
end
local Bindable = Instance.new("BindableFunction")
Bindable.OnInvoke = Callback
game.StarterGui:SetCore("SendNotification", {
Title = "hmm?";
Text = "?";
Duration = "300";
Button1 = "YES";
Button2 = "ew no";
Icon = "rbxassetid://7635712200";
Callback = Bindable
})
2 Likes
Thank you for the support, but the solution seems to not be working for me. Any advice?
Kaid3n22
(Kaiden)
October 11, 2021, 11:28pm
#4
Oh Whoops, used Bindable event instead of function. change this line
local Bindable = Instance.new("BindableEvent")
to this
local Bindable = Instance.new("BindableFunction")
1 Like
Thank you! This works, but is there anyway to determine a different input depending on which button is pressed?
Kaid3n22
(Kaiden)
October 11, 2021, 11:32pm
#6
you would check what the answer is equal to.
function Callback(answer)
if answer == "YES" then
print("YES")
elseif answer == "ew no" then
print("ew no")
end
end
4 Likes