Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix character observer ending immediately when using immediate signal mode #3

Merged
merged 2 commits into from
Jun 6, 2023

Conversation

Sleitnick
Copy link
Owner

Closes #2

When workspace.SignalMode is set to Immediate mode, the CharacterAdded event fires before the parent of the character is set. Thus, once a non-yielded observer function is executed, it thinks that the character has been destroyed, and calls the cleanup function returned from the observer. This does not occur when SignalMode is set to Deferred mode.

To fix this, the observer function can be called within task.defer instead of task.spawn. This ensures that the parent of the character has been assigned.

@Sleitnick
Copy link
Owner Author

Blocked by some NPM-related items. Will be merged soon (hopefully today).

@Sleitnick Sleitnick merged commit 4d49f91 into main Jun 6, 2023
2 checks passed
@Sleitnick Sleitnick deleted the bugfix/observe-character branch June 6, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

observeCharacter immediately calls cleanup
1 participant