I am currently attempting to create a invite system for players to invite their friends for in-game rewards… This ofc, means using the GameInvitePromptClosed to return the IDs of what the player invited… I am running into a problem with the event returning a empty array of ID’s
– Code
Client sided
local Event = game.ReplicatedStorage:WaitForChild("InviteEvent")
local Player = game.Players.LocalPlayer
script.Parent.Button.Activated:Connect(function()
if SocialService:CanSendGameInviteAsync(Player) then
SocialService:PromptGameInvite(Player)
end
end)
SocialService.GameInvitePromptClosed:Connect(function(plr, invited)
print("fired", #invited)
for i,v in pairs(invited) do
print(i,v)
local Name = game.Players:GetNameFromUserIdAsync(v)
if Name then
print(Name)
end
end
end)
Sadly, no matter how many people I invite, it’ll always print “fired 0” and thats all…
It doesn’t return more than an empty table. I was trying this awhile back, I believe they stated it on the forum here somewhere as it’s not on the wiki, but they removed it for whatever reason, so it doesn’t actually return the list of IDs.
I forget the exact reason why, but they removed seeing the ID of the friends the user invited. That’s why what I had to do for my system was just say, “Hey, they opened the prompt, if any friends join off them now for the next X minutes, give them a bonus.”
But in general I just give a small bonus if they have a friend join off of them no matter what.