How do I make a hide players button?

I am making a game where you can build with a lot of different blocks.

But right now I am making a button that hides all other players, but if you are one of the players you’re still visible.

1 Like

i learned here ^

1 Like
local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:Wait()
local button = script.Parent

button.MouseButton1Click:Connect(function()
	for i, plr in pairs(players:GetPlayers()) do
		if plr.Name ~= player.Name then
			local char = player.Character
			for i, child in pairs(char:GetChildren()) do
				if child:IsA("Part") or child:IsA("MeshPart") then
					child.Transparency = 1
				elseif child:IsA("Accessory") then
					child:FindFirstChild("Handle").Transparency = 1
				end
			end
		end
	end
end)

Local script, place it inside the UI button you want to cause the effect to occur.

6 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.