Ok so I am using a script I found local hide = true --Whether to hide, can be manipulated local True = true
local orignalTransparency = {}--Store original transparency local function checkPart(part) --This will set the transparency of every part for a,b in pairs(part:GetChildren()) do checkPart(b) --If there are more parts, also set the transparency for them too end if part:IsA("BasePart") or part:IsA("Decal") then--If the object is a part or decal, set it's transparency. (Face is a decal) if hide then --If we want to hide players, make their parts invisible if not orignalTransparency[part] then--Store data for later if we want to undo the effect orignalTransparency[part] = part.Transparency end part.Transparency = 1 else --If we don't want to hide, set the transparency back to normal if orignalTransparency[part] then --If we stored it part.Transparency = orignalTransparency[part] --Set it orignalTransparency[part] = nil --Remove reference because we do not need it anymore, prevents memory leaks end end end end local players = game:GetService("Players") local localPlayer = players.LocalPlayer game:GetService("RunService").RenderStepped:Connect(function() --Every frame, set transparency --Iterate through players to make them invisible for i,v in pairs(players:GetPlayers()) do --Go through every player if v ~= localPlayer then --This makes sure we don't make ourself invisble. Remove this for everyone. local char = v.Character if char then--If the character exists checkPart(char) end end end --Prevent memory leaks, if a part does not exist anymore we do not need to reference it for part,trans in pairs(orignalTransparency) do if not part then orignalTransparency[part] = nil elseif not part.Parent then orignalTransparency[part] = nil end end end) hide = true
It works perfectly fine just, I want to make it so when I press a gui button is makes it back to normal were everyone is back to being visible locally. Plz help
we talked about this over discord and came up with this solution.
--shows/hides the player depending on what command variable is --if command is 'hide' then we hide the player, if it is 'show' then we show the player function hideShowPlayer(player, command) --checks to see if the player's character exists and the player we're trying to hide isnt the local player if(player.Character and player ~= game.Players.LocalPlayer)then --loop through all the items inside the player for _, desc in pairs(player.Character:GetDescendants())do --check if the item we're currently looking at is a decal/brick if desc:IsA("BasePart") or desc:IsA("Decal") then --if it is a decal/brick set it's transparency to show/hide depending on what the command variable is if(command == "hide")then desc.Transparency = 1 else desc.Transparency = 0 end end end end end for _, player in pairs(game.Players:GetPlayers())do hideShowPlayer(player, "hide") end