Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make that one player is not transparent, but other players for him are transparent? [closed]

Asked by 3 years ago
Edited 3 years ago

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!

Closed as Not Constructive by BestCreativeBoy, AntoninFearless, and JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
WoTrox 345 Moderation Voter
3 years ago

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

Ad