I am using Roblox’s “SendNotification” to accept or decline invites from other players. However, I need the players name to pass to another function. “SendNotification” only allows the players input to be passed through and not any extra parameters when setting a “Callback”. For example:
Callback = myBindableFunction -- This will only pass the players input & nothing else
Callback = myBindableFucntion:Invoke(answer) -- This will return nil
Callback = function() end -- This needs to be a BindableFunction
A visual example of what I want to achieve:
local function myFunction(otherPlayer)
game:GetService("StarterGui"):SetCore("SendNotification",{
Callback = function(myAnswer) -- How to make this a BindableFunction
print(myAnswer, otherPlayer)
end})
end
myFunction("Friend")
The reason I am doing it this way is because if both of my friends send me a notification the most recent friend will overwrite the other friend (When I set a variable to who sent me a notification)
For example:
local whatFriend = otherPlayer
I have already tried to make a table for players who’ve sent notifications and tried to make it a spawn function instead, and both results kept overlapping. I just need to figure out how to make the callback a function inside the scope of “SendNotification”
This is an example from Roblox’s CoreGUI Notification script and it’s what I am looking for.
sendNotificationInfo {
GroupName = "Friends",
Title = fromPlayer.Name,
Text = "Sent you a friend request!",
DetailText = fromPlayer.Name,
Image = getFriendImage(fromPlayer.UserId),
Duration = 8,
Callback = function(buttonChosen) -- Why is their function activating but not mine?
if buttonChosen == acceptText then
AnalyticsService:ReportCounter("NotificationScript-RequestFriendship")
AnalyticsService:TrackEvent("Game", "RequestFriendship", "NotificationScript")
LocalPlayer:RequestFriendship(fromPlayer) -- "fromPlayer" is also in the scope
Hopefully I got my issue into words. I currently cannot think outside the box because I don’t know any other way about doing this, so now I am resulting to the devforum for some new brains to help me solve this. Any feedback or ideas would be appreciated!