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

2 comments
when is this code being called? If it is just in the script like this then it will only ever run ONCE
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