Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My notification that asks a question isn't working proparly how do i fix it?

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
})

2 answers

✓ Accepted answer

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

4 comments

0

thanks ill see if this works

0

im glad you found out about this

0

works thank you so much i was about to give up on this script i really apreciate it

0

np :p

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;
})

This discussion is preserved as it was. New answers, comments, and votes are closed.