How would I achieve this? A game already did it
Notice how “Lord” keeps sending you friend request, if you accept it you die, if you don’t nothing happens.
How would I achieve this? A game already did it
Notice how “Lord” keeps sending you friend request, if you accept it you die, if you don’t nothing happens.
simple enough
Local script in starter player scripts
local starter_gui = game:GetService("StarterGui")
local players = game:GetService("Players")
local plr = players.LocalPlayer
local img = players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
local callback = Instance.new("BindableFunction") -- the callback
local data = {
Title = "Friend Request",
Icon = img, -- person's img here
Button1 = "Accept",
Button2 = "Decline",
Text = "Someone sent you a friend request",
Callback = callback
}
starter_gui:SetCore("SendNotification", data)
callback.OnInvoke = function(btn)
if btn:lower() == "accept" then
print('player accepted friend req')
-- code here
end
end
@commitblue
if u have any questions then feel free to ask
Interesting. But how do I check if it declined request?
just add an elsif
local starter_gui = game:GetService("StarterGui")
local players = game:GetService("Players")
local plr = players.LocalPlayer
local img = players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
local callback = Instance.new("BindableFunction") -- the callback
local data = {
Title = "Friend Request",
Icon = img, -- person's img here
Button1 = "Accept",
Button2 = "Decline",
Text = "Someone sent you a friend request",
Callback = callback
}
starter_gui:SetCore("SendNotification", data)
callback.OnInvoke = function(btn)
if btn:lower() == "accept" then
print('player accepted friend req')
-- code here
elseif btn:lower() == "decline" then
print("player declined friend req")
-- code
end
end