Created
July 30, 2021 17:13
-
-
Save RobertCodez/6a796700f9e846fd5a4d4cd10d6a09e0 to your computer and use it in GitHub Desktop.
Player Transparency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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