Best way to make characters invisible?

In my game I have an avatar editor, however whenever there is 2 people they stack ontop of eachother. The only solution i could find was looping through players and making their characters invisible and not collidable. Is there a better way for doing this?

2 Likes

If you are looking up a way to make characters invisible you might want to research something called BasePart.LocalTransparencyModifier

How would I make it so players cannot collide?

You can use CollisionGroups: https://developer.roblox.com/articles/Collision-Filtering

You can use a pairs loop and an :IsA() statement to make the character transparent.

If you’d like an example of how this’d work, just let me know. :smile:

XY Problem.

To make your characters invisible, you set the Transparency property. It’s that simple.

As for what you wanted, which was to prevent the stacking of characters, CollisionGroups as posted by Nezuo would work for your use case. How are characters stacking though, if it’s just an Avatar Editor? Shouldn’t you only be able to view your own character in such a view?

1 Like

In my avatar editor i teleport the player when joined to a certain CFrame. Is there a better way of doing it?

I wouldn’t say “better”, but there’s an alternative way of doing it. Your current implementation keeps characters in a global environment of sorts, so they can still see each other while editing their character. Personally, I’d suggest handling avatar editing on the client-side. The workflow would be something like this:

  • A singular room with a Camera CFrame
  • All characters editing avatars view this CFrame and have a pseudo character constructed (false NPC) on the client-side
  • Any edits on the avatars are applied to the pseudo character, while confirming the edits applies them to the actual character

There isn’t anything that wrong with teleporting avatars around and modifying them the way you currently are, though even if you use collision groups, there’s still the overhead of overlapping characters to accommodate. You may end up with a mass of other characters in one area depending on how you’re currently handling teleportations, so characters may merge with each other. For example, it might look like this:

Obviously the image is exaggerated, but it’s meant to show you that character overlap may happen. Collision filtering will surely mitigate the issue of stacking characters, but you might find yourself with this kind of a problem instead. I’m just assuming though; I’m not sure how your implementation works.

2 Likes

Okay thanks for your help.

2 Likes