local notify = game.ReplicatedStorage.Notify
local sg = game:GetService("StarterGui")
local cb = Instance.new("BindableFunction")
cb = function(who,what)
print(who)
if what ~= nil then
print(what)
end
end
notify.OnClientEvent:Connect(function(title,text,icon,dur,b1,b2)
sg:SetCore("SendNotification", {
Title = title;
Text = text;
Icon = icon;
Duration = dur;
Callback = cb;
Button1 = b1;
Button2 = b2
})
end)
The problem is when i click either of the buttons it doesnt print anything, when it should print the text on the button.
The documentation says that Callback must be a BindableFunction, but yours is a function (cb = function(who,what)). It also sends only the selected answer (the button that was clicked)
local notify = game.ReplicatedStorage.Notify
local sg = game:GetService("StarterGui")
local cb = Instance.new("BindableFunction")
cb.OnInvoke = function(what)
if what ~= nil then
print(what)
end
end
notify.OnClientEvent:Connect(function(title,text,icon,dur,b1,b2)
sg:SetCore("SendNotification", {
Title = title;
Text = text;
Icon = icon;
Duration = dur;
Callback = cb;
Button1 = b1;
Button2 = b2
})
end)