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:

01local team = game.Teams["Choosing..."]
02local plr = game.Players.LocalPlayer
03 
04 
05    game.ReplicatedStorage.changeTeam:FireServer(team)
06 
07 
08    for _,player in pairs(game.Players:GetChildren()) do
09 
10        player.CharacterAdded:Connect(function(char)
11            for _,cPart in pairs(char:GetChildren()) do
12 
13                if not cPart:IsA('BasePart') then return end
14                cPart.LocalTransparencyModifier = 1
15 
16            end    
17        end)
18    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) :

01for i,Foundplayer in pairs(game.Players:GetPlayers()) do
02        if Foundplayer.Name ~= player.Name then
03 
04        for i,Child in pairs(Foundplayer.Character:GetChildren()) do   
05        if Child:IsA("Part") or Child:IsA("MeshPart") then
06            Child.Transparency = 1
07 
08        end
09        if Child:IsA("Accessory") then
10            Child.Handle.Transparency = 1
11        end
12        end
13 
14        end
15        Foundplayer.Character.Head.face.Transparency = 1   
16 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