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
