Skip to content

Instantly share code, notes, and snippets.

@RobertCodez
Created July 30, 2021 17:13
Show Gist options
  • Save RobertCodez/6a796700f9e846fd5a4d4cd10d6a09e0 to your computer and use it in GitHub Desktop.
Save RobertCodez/6a796700f9e846fd5a4d4cd10d6a09e0 to your computer and use it in GitHub Desktop.
Player Transparency
local rStorage = game:GetService("ReplicatedStorage")
local rEvents = rStorage:WaitForChild("RemoteEvents")
local plr = game.Players.LocalPlayer
rEvents.HidePlayers.OnClientEvent:Connect(function()
for i,v in pairs(game.Players:GetChildren()) do
if v.Name ~= plr.Name then
local char = workspace:WaitForChild(v.Name)
for i,part in pairs(char:GetDescendants()) do
if part:IsA("BasePart") then
part.Transparency = 1
end
end
end
end
end)
rEvents.ShowPlayers.OnClientEvent:Connect(function()
for i,v in pairs(game.Players:GetChildren()) do
if v.Name ~= plr.Name then
local char = workspace:WaitForChild(v.Name)
for i,part in pairs(char:GetDescendants()) do
if part:IsA("BasePart") then
part.Transparency = 0
end
end
end
end
end)
rEvents.HideSelf.OnClientEvent:Connect(function()
local char = workspace:WaitForChild(plr.Name)
for i,v in pairs(char:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Decal") then
v.Transparency = 1
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment