local player = game.Players.LocalPlayer
while wait() do
for _, currentplayer in pairs(game.Players:GetPlayers()) do
if not currentplayer.UserId == player.UserId then
if player:IsFriendsWith(currentplayer.UserId) then
if not currentplayer.Character:FindFirstChild("Highlight") then
local Highlight = Instance.new("Highlight")
Highlight.Parent = currentplayer.Character
Highlight.DepthMode = Enum.HighlightDepthMode.Occluded
Highlight.FillTransparency = 1
Highlight.OutlineColor = Color3.fromRGB(76, 229, 0)
end
else
if currentplayer.Character:FindFirstChild("Highlight") then
currentplayer.Character:FindFirstChild("Highlight"):Destroy()
end
end
end
end
end
I want players who are friends with other players to have the other players highlighted. The script above doesnt show any error and doesnt work
local Game = game
local Players = Game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local function OnPlayerAdded(Player)
local function OnCharacterAdded(Character)
local Success, Result = pcall(function() return LocalPlayer:IsFriendsWith(Player) end)
if not Success then warn(Result) return end
if not Result then return end
local Highlight = Instance.new("Highlight")
Highlight.Adornee = Character
Highlight.Parent = Character
end
local Character = Player.Character
if Character then OnCharacterAdded(Character) else Player.CharacterAdded:Connect(OnCharacterAdded) end
end
Players.PlayerAdded:Connect(OnPlayerAdded)