Recently I have been trying to get a script that gives 5 coins when a user's friend joins. I've been trying to find a way to do this but am unable to.
I am guessing it's a pretty easy script but I have never done something that tries to detect if a user's friend has joined; If someone could help it would highly be appreciated!
You can use the :IsFriendsWith()
function and you would add the player's UserId as the parameter. But here is the code in your situation:
game.Players.PlayerAdded:Connect(function(player) for _,v in pairs(game.Players:GetPlayers()) do if v:IsFriendsWith(player.UserId) then -- reward coins end end end)