Skip to content

Conversation

@Lucatacos
Copy link
Contributor

@Lucatacos Lucatacos commented Jan 12, 2025

Changes

I've optimized the script for handling collision groups in Roblox. The main change involves removing the connection to DescendantAdded, applying the collision group immediately to all parts in the model upon character addition. This reduces unnecessary event connections, improving performance by applying the collision group once for all descendants, rather than repeatedly when new parts are added. This should help improve game performance, especially when handling many parts or players.

Checks

By submitting your pull request for review, you agree to the following:

  • This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses.
  • I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses.
  • To the best of my knowledge, all proposed changes are accurate.

…ction for Improved Performance

I've optimized the script for handling collision groups in Roblox. The main change involves removing the connection to DescendantAdded, applying the collision group immediately to all parts in the model upon character addition. This reduces unnecessary event connections, improving performance by applying the collision group once for all descendants, rather than repeatedly when new parts are added. This should help improve game performance, especially when handling many parts or players.
@Lucatacos Lucatacos requested a review from a team as a code owner January 12, 2025 19:41
@github-actions github-actions bot added the engine guides Changes the Engine guides label Jan 12, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Lucatacos, thanks so much for helping improve the Roblox creator documentation! Our technical writing team will review your pull request soon. In the meantime, please ensure you've read through the README.md, contribution guidelines, and style recommendations.

@github-actions github-actions bot added the changes requested This pull request has changes requested prior to merging label Jan 12, 2025
@IgnisRBX
Copy link
Contributor

I was initially a bit concerned by this change, in that all of the character BaseParts wouldn't be loaded in by the time CharacterAdded fires, but all of the collision-prone parts should be loaded at this point. If you detect otherwise in any future testing, please file another PR to restore the DescendantAdded bit which would account for any BaseParts added after the CharacterAdded event. Thanks!

@IgnisRBX
Copy link
Contributor

FYI, I also removed the pairs() bit of the loop, since you can now omit pairs() and just operate on the table directly. :)

@IgnisRBX IgnisRBX merged commit d7998a5 into Roblox:main Jan 13, 2025
3 checks passed
@Lucatacos Lucatacos deleted the patch-1 branch April 15, 2025 15:36
Lucatacos added a commit to Lucatacos/creator-docs that referenced this pull request Aug 8, 2025
…mple

Reverting my change (Roblox#984) because the original example is clearer and handles all cases better.
It properly sets collision groups for parts added after the character spawns, which my version didn’t cover.
This makes the official documentation more complete and easier to understand.

Regarding performance, the difference is minimal for most use cases, but the original version is safer as it handles dynamic parts correctly without impacting performance noticeably.
Lucatacos added a commit to Lucatacos/creator-docs that referenced this pull request Aug 8, 2025
…mple

Reverting my change (Roblox#984) because the original example is clearer and handles all cases better. It properly sets collision groups for parts added after the character spawns, which my version didn’t cover. This makes the official documentation more complete and easier to understand.

Regarding performance, the difference is minimal for most use cases, but the original version is safer as it handles dynamic parts correctly without impacting performance noticeably
IgnisRBX pushed a commit that referenced this pull request Aug 8, 2025
…mple (#1196)

## Changes
Reverting my change (#984)
because the original example is clearer and handles all cases better. It
properly sets collision groups for parts added after the character
spawns, which my version didn’t cover. This makes the official
documentation more complete and easier to understand.

Regarding performance, the difference is minimal for most use cases, but
the original version is safer as it handles dynamic parts correctly
without impacting performance noticeably

## Checks

By submitting your pull request for review, you agree to the following:

- [ ] This contribution was created in whole or in part by me, and I
have the right to submit it under the terms of this repository's open
source licenses.
- [ ] I understand and agree that this contribution and a record of it
are public, maintained indefinitely, and may be redistributed under the
terms of this repository's open source licenses.
- [ ] To the best of my knowledge, all proposed changes are accurate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes requested This pull request has changes requested prior to merging engine guides Changes the Engine guides

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants