Hi there! So I’m making a system where a player can invite somebody to their apartment, and I want to know how I can make notifications have the functionality to them. For example, let’s say I accept, it will teleport the user to the apartment and you will be able to interact in their apartment as usual; whereas you decline, it’ll ignore and not do anything. There’ll be a time limit between invites etc.
Now, I want to make the accept button function. Here’s my script if you have any questions:
game:GetService("StarterGui"):SetCore("SendNotification", {
Title = "Apartment Invitation"; --must be string
Text = "@username invited you to their apartment!"; --must be string
Icon = script.Decal.Texture ; --optional
Duration = 10; -- defaults to 5 secs if no duration is set
Button1 = "Accept";
Button2 = "Decline";
})
local Func = Instance.new("BindableFunction")
function Func.OnInvoke(Response)
print(Response)
end
game:GetService("StarterGui"):SetCore("SendNotification", {
Title = "Apartment Invitation"; --must be string
Text = "@username invited you to their apartment!"; --must be string
Icon = script.Decal.Texture ; --optional
Duration = 10; -- defaults to 5 secs if no duration is set
Callback = Func,
Button1 = "Accept";
Button2 = "Decline";
})
Can you explain what the script does? I’m not getting the whole “response” thing here, it’s creating a BindableFunction, which I don’t know what it does, then it prints out the BindableFunction… in the console if something is pressed?
Store the BindableFunction somewhere in replicatedstorage.
local Bind = game:GetService("ReplicatedStorage").BindableFunction
Bind.OnInvoke = function(Button)
print(Button) -- Should print either button1 or button2 depending on which one you pressed.
end
game:GetService("StarterGui"):SetCore("SendNotification", {
Title = "Apartment Invitation"; --must be string
Text = "@username invited you to their apartment!"; --must be string
Icon = script.Decal.Texture ; --optional
Duration = 10; -- defaults to 5 secs if no duration is set
Callback = Bind;
Button1 = "Accept";
Button2 = "Decline";
})