Basically, i did a customization system and i want to hide the other players(Only by the client) when the player is changing the character.
What is the best way to do this?
Basically, i did a customization system and i want to hide the other players(Only by the client) when the player is changing the character.
What is the best way to do this?
Loop through every other player and change the transparency for all of their parts to 1. You would also have to store all their accessories in a table and then delete them ingame.
You could send a snippet of code so we can implement it for you.
Should i get the players and then get the parts? Can i see a exemple of this?
Exactly.
Something like this should work: (just for changing the transparency)
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
--//Set a character's transparency to 1
local function SetCharacterTransparency(character)
for i, descendant in ipairs(character:GetDescendants()) do
if not descendant:IsA("BasePart") then
continue
end
descendant.Transparency = 1
end
end
--//Set all player's character's transparency to 1
for i, player in ipairs(Players:GetPlayers()) do
if player == LocalPlayer then
continue
end
player.CharacterAdded:Connect(function(character)
if not player:HasAppearanceLoaded() then
player.CharacterAppearanceLoaded:Wait()
end
SetCharacterTransparency(character)
end)
if not player.Character then
continue
end
SetCharacterTransparency(player.Character)
end
If you would like, you can send me a game file and I can add this in.
Yes, that would work, however you should probably make this effective on players joining, not just respawning.
So, this localscript just set the transparency of my player to 1, i still can see the other players.
Hm that’s weird, it works fine for me. Are you sure you have no other scripts affecting it?
Yea I just made a quick script, there are definitely improvements that can be made.
Set the other players’ character’s parent to nil or a folder outside of the Workspace (which would probably be better). But you’ll have to account for new characters being added, as well as setting removing those references if a player leaves in order to avoid memory leaks. This last part can be ignored if you go with a folder option as you won’t have to keep any references in memory and can just iterate through the folder.
Do you have a StarterCharacter in your game? I suppose that could effect something.
I found this topic really useful:
Hope this helps
I did something like this:
for i ,player in ipairs(game.Players:GetPlayers()) do
local character = player.Character
character = nil
end
It worked, but when a new player enters the server, the script don’t work. Btw the faces, accessories don’t disappear, how to fix it?
This works for all player character’s currently in game, but you need to create a PlayerAdded connection to remove new character’s along with a character added event for all the player’s