Hello guys! Im currently working on a game, and I want to create a script what make your own character not transparent, but other players characters transparency to 0.5 (So this need to be a local script). So like in a game we have Player1, Player2, Player3. On Player2's computer, he is not transparent, but other players character have a transparency of 0.5. And reversed too, so if we see Player3's computer, he dont have transparency, but other players character has. How can I do this? Thank you guys for helping!
COMMUNITY QUESTION
How to make that one player is not transparent, but other players for him are transparent?
1 answer
As you said, you need a Local Script for this.
local player = game.Players.LocalPlayer
--Set the character's transparency for the players' that are already on the server:
for i, v in pairs(game.Players:GetPlayers()) do --Loop through all the players
if v ~= player then --Check if the player is you ("~" is the same as "not")
for k, b in pairs(v.Character:GetChildren()) do --Loop through the player's character
if b:IsA("Part") then --Check if it's a part
b.Transparency = 0.5
end
end
end
end
--And if a new player joins:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
--And loop through the character (but change "v.Character" to "char")
end)
end)
Let me know if I helped
This discussion is preserved as it was. New answers, comments, and votes are closed.
