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

Unable to hide other players' characters?

Asked by 5 years ago
Edited 5 years ago

Hey there once again, I am developing a game and I have a skybox that every player spawns in, and I need to make each player look like he's there alone - hide other players.

I tried making a script as follows:

local team = game.Teams["Choosing..."]
local plr = game.Players.LocalPlayer


    game.ReplicatedStorage.changeTeam:FireServer(team)


    for _,player in pairs(game.Players:GetChildren()) do

        player.CharacterAdded:Connect(function(char)
            for _,cPart in pairs(char:GetChildren()) do

                if not cPart:IsA('BasePart') then return end
                cPart.LocalTransparencyModifier = 1

            end     
        end)
    end


The other part of code activates, so the script runs, but it doesn't do anything, I still see other players. It is in a LocalScript as suggested, but it doesn't run in localscript nor a normal one.

Any help on fixing my code? (Or suggesting a other way to do it)

Thanks in advance, any tips appreciated.

EDIT-1: I realized the property is only of BaseParts, I also posted my new and whole code

0
when is this code being called? If it is just in the script like this then it will only ever run ONCE SynthetickDev 188 — 5y
0
It is in a localscript, so it should call when a player joins the game. And the changeTeam event fires successfuly, so as I said, the script 100% gets ran Doge_Brigade 94 — 5y

1 answer

Log in to vote
1
Answered by
EthanFins 104
5 years ago

Your not alone I had this problem here's there script (This will Make every character but yours disappear, But you can do what you want with it) :

for i,Foundplayer in pairs(game.Players:GetPlayers()) do
        if Foundplayer.Name ~= player.Name then 

        for i,Child in pairs(Foundplayer.Character:GetChildren()) do    
        if Child:IsA("Part") or Child:IsA("MeshPart") then
            Child.Transparency = 1

        end 
        if Child:IsA("Accessory") then
            Child.Handle.Transparency = 1
        end
        end

        end 
        Foundplayer.Character.Head.face.Transparency = 1    
 end

Hope this Helped!

0
I guess I have to do it this way. Thanks! Doge_Brigade 94 — 5y
0
Np EthanFins 104 — 5y
Ad

Answer this question