SendNotification CallBack

Hello, I’m currently making a team invite system where you can request people on your team using the Send Notification future. I was wondering, how can I make the script detect if the player doesn’t respond to the prompt within the 5 Second Duration I have set.

local BindFunction = Instance.new("BindableFunction")

function BindFunction.OnInvoke(response)
	InviteRequestResponse = response
	print(response)
end

local function RequestTeamate(Player)
	StarterGui:SetCore("SendNotification", {
		Title = "Teammate Request";
		Text = Player.Team.Name.." Team has sent you an invite";
		Duration = 5;
		Callback = BindFunction;
		Button1 = "Yes";
		Button2 = "No";
	})
end
1 Like
  • set a variable to check to see if responded:
local hasresponded = false

if any of the options have been clicked, set “hasresponded” to true so that the next bit of code doesnt think you havent responded

  • then inside the “RequestTeamate” function you got there, (more specifically under the :SetCore() function you have there) do:
spawn(function()
       wait(5)
      if hasresponded == false then
             --insert necessary code  
      end 
end)

and yeah, pretty much thats how you do it. simple as that huh?
if you have any questions, reply to this post