In this script there are 3 simple things that are suppose to happen. If your on :
player.PlayerService.PlayerTeam.Value = BrickColor.new"White"
then all other players are completely invisible.
If you are on:
player.PlayerService.PlayerTeam.Value = BrickColor.new"Medium stone grey"
then everyone is completely visible
If you are on:
player.PlayerService.PlayerTeam.Value = BrickColor.new"Bright red"
Then all other players are transparent and red
I have tested this script in studio with a server of 2 players, it worked in both cases. But when I asked my brother and sister to test it with me the transparency part didn't work, but when the game started one of them turned transparent red. My game is set up very specifically with lots of int values and string values for the players. If you have any questions on why something is the way it is, ill answer that question.
Here is the script:
local player = game.Players.LocalPlayer
local char = player.Character
wait()
for _, v in pairs(game.Players:GetChildren()) do
if v.Name == player.Name then
wait()
elseif v:IsA'Player' then
for p, t in pairs (v.Character:GetChildren()) do
if t:IsA'Part' then
t.Transparency = 1
elseif t:IsA'Hat' then
t.Handle.Transparency = 1
v.Head.Face.Transparency = 1
end
end
end
end
game.Players.PlayerAdded:connect(function (newPlayer)
if player.PlayerService.PlayerTeam.Value == BrickColor.new("White") then
for _, v in pairs(game.Players:GetChildren()) do
if v.Name == player.Name then
wait()
elseif v:IsA'Player' then
for p, t in pairs (v.Character:GetChildren()) do
if t:IsA'Part' then
t.Transparency = 1
elseif t:IsA'Hat' then
t.Handle.Transparency = 1
v.Head.Face.Transparency = 1
end
end
end
end
end
end)
player.PlayerService.PlayerTeam.changed:connect(function(val)
wait()
if val == BrickColor.new("White") then
for _, v in pairs(game.Players:GetChildren()) do
if v.Name == player.Name then
wait()
elseif v:IsA'Player' then
for p, t in pairs (v.Character:GetChildren()) do
if t:IsA'Part' then
t.Transparency = 1
elseif t:IsA'Hat' then
t.Handle.Transparency = 1
v.Head.Face.Transparency = 1
end
end
end
end
end
end)
player.PlayerService.PlayerTeam.changed:connect(function(val)
wait()
if val == BrickColor.new("Bright red") then
for _, v in pairs(game.Players:GetChildren()) do
if v.Name == player.Name then
wait()
elseif v:IsA'Player' then
for p, t in pairs (v.Character:GetChildren()) do
if t:IsA'Part' then
t.Transparency = 0.75
t.BrickColor = BrickColor.new("Bright red")
elseif t:IsA'Hat' then
t:Destroy()
v.Head.Face.Transparency = 0.75
end
end
end
end
end
end)
player.PlayerService.PlayerTeam.changed:connect(function(val)
if val == BrickColor.new("Medium stone grey") then
for _, v in pairs(game.Players:GetChildren()) do
if v.Name == player.Name then
wait()
elseif v:IsA'Player' then
for p, t in pairs (v.Character:GetChildren()) do
if t:IsA'Part' then
t.Transparency = 0
elseif t:IsA'Hat' then
t.Handle.Transparency = 0
v.Head.Face.Transparency = 1
end
end
end
end
end
end)

1 comment
Once a player joins, how quickly does their team color get set? As soon as they join?