How to make All players invisible

Hello, is there a way to make it where all players in the game but urself goes invisible even the things there holding?

for _, v in pairs(game.Players:GetChildren()) do
for _, e in pairs(v.Character:GetDescendants()) do
if e:IsA("BasePart") then
e.Transparency = 1
end
end
end

is this inside of a textbutton?

-- assuming this is local script,
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local function HideAllPlayer() -- creating function
	for i,player in ipairs(Players:GetPlayer()) do -- getting all player
		if player == LocalPlayer then continue end -- checking if the player is local player, if it is then skip
		if player.Character then -- checking if player have character
			for i,part in ipairs(player.Character:GetDescendants()) do -- looping through everything inside character
				if part:IsA("BasePart") or part:IsA("Decal") then -- checking if part is a part or decal
					if Hiding then -- if Hiding is on
						if HidedPart[part] then -- if this part was hided
							HidedPart[part] = nil -- removing part from hided table
							part.Transparency = 0 -- making part visible
						end
					else -- Hiding is off, turn on hiding
						if part.Transparency ~= 1 then -- checking if part is already invisible
							part.Transparency = 1 -- making part invisible
							HidedPart[part] = true -- inserting part into table
						end
					end
				end
			end
		end
	end
	Hiding = not Hiding -- Hiding will be the opposite (true -> false, false -> true)
end
HideAllPlayer() -- calling the function
task.wait(10)
HideAllPlayer() -- calling the function again

This will only work inside a text button or image button

-- Local Script

local players = game:GetService("Players")
local local_player = players.LocalPlayer

local function invisible(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 1
		else
		end
	end
end

script.Parent.MouseButton1Click:Connect(function()
	for num,player in pairs (players:GetPlayers()) do
		if player ~= local_player then
			invisible(player)
		else
		end
	end
end)
1 Like
local players = game:GetService("Players")
local player = players.LocalPlayer

while task.wait() do
	for _, plr in ipairs(players:GetPlayers()) do
		if plr ~= player then
			local char = player.Character
			for _, part in ipairs(char:GetDescendants()) do
				if part:IsA("BasePart") or part:IsA("Decal") then
					part.Transparency = 1
				end
			end
			local bp = plr.Backpack
			for _, part in ipairs(bp:GetDescenants()) do
				if part:IsA("BasePart") or part:IsA("Decal") then
					part.Transparency = 1
				end
			end
		end 
	end
end)

This loop will run every frame ensuring every limb/tool/accessory of the player is transparent (invisible).

im making it where u can show them again but the humanoid root part shows can u help

local players = game:GetService("Players")
local local_player = players.LocalPlayer
local Invis = false

local function invisible(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 1
		else
		end
	end
end

local function Show(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 0
			v.Parent.HumanoidRootPart.Transparency = 1
		else
		end
	end
end


script.Parent.MouseButton1Click:Connect(function()
	for num,player in pairs (players:GetPlayers()) do
		if player ~= local_player then
			if not Invis then
				Invis = true
			invisible(player)
		else
				if Invis then
					
					Show(player)
					Invis = false
				end
			end
		end
	end
end)
local players = game:GetService("Players")
local local_player = players.LocalPlayer
local Invis = false

local function invisible(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 1
		else
		end
	end
end

local function Show(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if (v:IsA("BasePart") or v:IsA("Decal")) and v.Name ~= "HumanoidRootPart" then
			v.Transparency = 0
		else
		end
	end
end

and last thing how would i disable particles on the player or the tool?

local function invisible(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 1
		elseif v:IsA("ParticleEmitter") then
			v:Destroy()
		end
	end
end

What about enable off? if i did enable off would it mess the other things up Nvm i got it

do u know why this isnt working, i tried making it where the handle doesnt show and the particles go away but theres a problem, the particles go away but it never comes back but eveyrthing else works


local function invisible(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 1
			elseif v:IsA("ParticleEmitter") then
				v.Enabled = false
			else
			end
		end
	end


local function Show(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if (v:IsA("BasePart") or v:IsA("Decal")) and v.Name ~= "HumanoidRootPart" then
			v.Transparency = 0
			if v:IsA("Part") and v.Name == "Handle" then
				v.Transparency = 1 
			if v:IsA("ParticleEmitter") then
					v.Enabled = true
				else
					
				end
			end
		end
	end
end
local function Show(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if (v:IsA("BasePart") or v:IsA("Decal")) and v.Name ~= "HumanoidRootPart" then
			v.Transparency = 0
			if v:IsA("Part") and v.Name == "Handle" then
				v.Transparency = 1 
			elseif v:IsA("ParticleEmitter") then
				v.Enabled = true
			else

			end
		end
	end
end

You used if instead of elseif, that should be it.

still doesnt enable it back for some reason

local function invisible(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 1
		elseif v:IsA("ParticleEmitter") then
			v.Enabled = false
		else
			
		end
	end
end


local function Show(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if (v:IsA("BasePart") or v:IsA("Decal")) and v.Name ~= "HumanoidRootPart" then
			v.Transparency = 0
			if v:IsA("Part") and v.Name == "Handle" then
				v.Transparency = 1 
			elseif v:IsA("ParticleEmitter") then
				v.Enabled = true
			else

			end
		end
	end
end

particles still dont reappear for some reason

local function invisible(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = 1
		elseif v:IsA("ParticleEmitter") then
			v.Enabled = false
		else

		end
	end
end

local function Show(player_)
	for i,v in pairs (player_.Character:GetDescendants()) do
		if (v:IsA("BasePart") or v:IsA("Decal")) and v.Name ~= "HumanoidRootPart" then
			v.Transparency = 0
		elseif v:IsA("BasePart") and v.Name == "Handle" then
			v.Transparency = 1 
		elseif v:IsA("ParticleEmitter") then
			v.Enabled = true
		else

		end
	end
end

It’s because the ParticleEmitter checking was inside the BasePart and Decal checking, all of those conditional statements should just be 1 chain.