Hello, so I have this code right here used for removing a friend boost from a player if their friend leaves
for i = 1, #Players:GetPlayers() do
local playerLooped = Players:GetPlayers()[i]
if playerUserId ~= playerLooped.UserId then
if player:IsFriendsWith(playerLooped.UserId) then
playerLooped:FindFirstChild("CoinsMulti").Value /= playerLooped:FindFirstChild("FriendMulti").Value
playerLooped:FindFirstChild("FriendMulti").Value -= 0.25
end
end
end
For some reason, if player:IsFriendsWith(playerLooped.UserId) then errors out saying I need to use FriendService even though I used the same condition when a player joins and it seems to work fine.
You’re probably checking if you’re friends with yourself. Try checking if the indexed player is not the local player.
for i = 1, #Players:GetPlayers() do
local playerLooped = Players:GetPlayers()[i]
if playerUserId ~= playerLooped.UserId then
if player:IsFriendsWith(playerLooped.UserId) and player.UserId ~= playerLooped.UserId then
playerLooped:FindFirstChild("CoinsMulti").Value /= playerLooped:FindFirstChild("FriendMulti").Value
playerLooped:FindFirstChild("FriendMulti").Value -= 0.25
end
end
end
I did, and it doesn’t really help. The service is used to accept and decline requests aka the popup that shows when someone wants to be your friend. There’s no methods or anything that are useful.