Trying to make it so when you invite friends into the game through the Social Service, you get rewarded.
Script in ServerScriptService
local SocialService = game:GetService("SocialService")
game.ReplicatedStorage.PopUp_Friends.OnServerEvent:Connect(function(player)
SocialService:PromptGameInvite(player)
end)
SocialService.GameInvitePromptClosed:Connect(function(player, ids)
local rapPerInvite = 10
local rapMade = #ids * rapPerInvite
player.leaderstats.RAP.Value = player.leaderstats.RAP.Value + rapMade
end)
game.Players.PlayerAdded:Connect(function(player)
local ldr = Instance.new("Folder")
ldr.Name = "leaderstats"
ldr.Parent = player
local rap = Instance.new("IntValue")
rap.Name = "RAP"
rap.Value = 0
rap.Parent = ldr
end)
More information:
"ids" is the amount of people you've invited, I'm not sure if I did that incorrectly. However, it's supposed to be #ids (amount of players you invited) x rapPerInvite (Value = 10)
Can anybody tell me what's wrong with this script? Why is it not updating my leaderstat values?
