How to make the red Outlines Invisible on the players Client

so i have this script that makes players have a red outlines on a player, but i wanted to make the Main Player’s Red Outlines not Visible

local players = game:GetService("Players")



players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local hrp = char:WaitForChild("Torso")
		local extraobj = Instance.new("Part")
		extraobj.Parent = char
		extraobj.Name = "1OBJ"
		extraobj.Anchored = false
		extraobj.CanCollide = false
		extraobj.Transparency = 1
		extraobj.BrickColor = BrickColor.new("Really red")
		extraobj.Size = Vector3.new(2.1, 2.1, 1.1) 
		extraobj.Material = "ForceField"
		extraobj.Position = hrp.Position + Vector3.new(0,0,0)
		local SelectionBox = Instance.new("SelectionBox")
		SelectionBox.Parent = extraobj
		SelectionBox.Adornee = extraobj
		SelectionBox.Color3 = Color3.fromRGB(255, 0, 0)
		SelectionBox.LineThickness = 0.1
		local weld = Instance.new("WeldConstraint")
		weld.Parent = extraobj
		weld.Part0 = weld.Parent
		weld.Part1 = hrp
	end)
end)

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local hrp = char:WaitForChild("Left Leg")
		local extraobj = Instance.new("Part")
		extraobj.Parent = char
		extraobj.Name = "2OBJ"
		extraobj.Anchored = false
		extraobj.CanCollide = false
		extraobj.Transparency = 1
		extraobj.BrickColor = BrickColor.new("Really red")
		extraobj.Size = Vector3.new(1.1, 2.1, 1.1) 
		extraobj.Material = "ForceField"
		extraobj.Position = hrp.Position + Vector3.new(0,0,0)
		local SelectionBox = Instance.new("SelectionBox")
		SelectionBox.Parent = extraobj
		SelectionBox.Adornee = extraobj
		SelectionBox.Color3 = Color3.fromRGB(255, 0, 0)
		SelectionBox.LineThickness = 0.1
		local weld = Instance.new("WeldConstraint")
		weld.Parent = extraobj
		weld.Part0 = weld.Parent
		weld.Part1 = hrp
	end)
end)

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local hrp = char:WaitForChild("Right Leg")
		local extraobj = Instance.new("Part")
		extraobj.Parent = char
		extraobj.Name = "3OBJ"
		extraobj.Anchored = false
		extraobj.CanCollide = false
		extraobj.Transparency = 1
		extraobj.BrickColor = BrickColor.new("Really red")
		extraobj.Size = Vector3.new(1.1, 2.1, 1.1) 
		extraobj.Material = "ForceField"
		extraobj.Position = hrp.Position + Vector3.new(0,0,0)
		local SelectionBox = Instance.new("SelectionBox")
		SelectionBox.Parent = extraobj
		SelectionBox.Adornee = extraobj
		SelectionBox.Color3 = Color3.fromRGB(255, 0, 0)
		SelectionBox.LineThickness = 0.1
		local weld = Instance.new("WeldConstraint")
		weld.Parent = extraobj
		weld.Part0 = weld.Parent
		weld.Part1 = hrp
	end)
end)

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local hrp = char:WaitForChild("Left Arm")
		local extraobj = Instance.new("Part")
		extraobj.Parent = char
		extraobj.Name = "4OBJ"
		extraobj.Anchored = false
		extraobj.CanCollide = false
		extraobj.Transparency = 1
		extraobj.BrickColor = BrickColor.new("Really red")
		extraobj.Size = Vector3.new(1.1, 2.1, 1.1) 
		extraobj.Material = "ForceField"
		extraobj.Position = hrp.Position + Vector3.new(0,0,0)
		local SelectionBox = Instance.new("SelectionBox")
		SelectionBox.Parent = extraobj
		SelectionBox.Adornee = extraobj
		SelectionBox.Color3 = Color3.fromRGB(255, 0, 0)
		SelectionBox.LineThickness = 0.1
		local weld = Instance.new("WeldConstraint")
		weld.Parent = extraobj
		weld.Part0 = weld.Parent
		weld.Part1 = hrp
	end)
end)

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local hrp = char:WaitForChild("Right Arm")
		local extraobj = Instance.new("Part")
		extraobj.Parent = char
		extraobj.Name = "5OBJ"
		extraobj.Anchored = false
		extraobj.CanCollide = false
		extraobj.Transparency = 1
		extraobj.BrickColor = BrickColor.new("Really red")
		extraobj.Size = Vector3.new(1.1, 2.1, 1.1) 
		extraobj.Material = "ForceField"
		extraobj.Position = hrp.Position + Vector3.new(0,0,0)
		local SelectionBox = Instance.new("SelectionBox")
		SelectionBox.Parent = extraobj
		SelectionBox.Adornee = extraobj
		SelectionBox.Color3 = Color3.fromRGB(255, 0, 0)
		SelectionBox.LineThickness = 0.1
		local weld = Instance.new("WeldConstraint")
		weld.Parent = extraobj
		weld.Part0 = weld.Parent
		weld.Part1 = hrp
	end)
end)







local players = game:GetService("Players")
local selfPlayer = players.LocalPlayer or players.PlayerAdded:Wait()

players.PlayerAdded:Connect(function(player)
	if selfPlayer.Name == player.Name then
		player.CharacterAdded:Connect(function(character)
			player.CharacterAppearanceLoaded:Connect(function(character)
				for i, instance in pairs(character:GetChildren()) do
					if string.match(instance.Name, "OBJ$") then
						for i, desc in pairs(instance:GetDescendants()) do
							if desc:IsA("SelectionBox") then
								desc.SurfaceTransparency = 1
							end
						end
					end
				end
			end)
		end)
	end
end)

Local script.

1 Like

nvm i did it my self lol
i put it StarterPlayerScript

local function indicatePlayers(char)
	if not char:FindFirstChild("SelectionBox") then
		for i,v in pairs(char:GetChildren()) do
			if v:IsA("MeshPart") or v:IsA("Part") then
				local ins = Instance.new("SelectionBox")
				ins.Adornee = v
				ins.Color3 = Color3.fromRGB(255, 0, 0)
				ins.LineThickness = 0.075
				ins.Parent = v
			end
		end
	end
end


game:GetService("RunService").RenderStepped:Connect(function()
	for i, plr in pairs(game.Players:GetPlayers()) do
		if plr ~= game.Players.LocalPlayer then
			local char = plr.Character or plr.CharacterAdded:Wait()
			indicatePlayers(char)
		end
	end
end)