Skip to content

Adds singleton property to modulescripts - #1061

Draft
JustBorgar wants to merge 1 commit into
Polytoria:mainfrom
JustBorgar:singleton_modules
Draft

Adds singleton property to modulescripts#1061
JustBorgar wants to merge 1 commit into
Polytoria:mainfrom
JustBorgar:singleton_modules

Conversation

@JustBorgar

@JustBorgar JustBorgar commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Singleton property to module scripts, allowing them to run on their own, which is useful for imperative scripts that need to share state via signals, but don't necessarily need any input (eg. a MusicZones script with State/Sound/Playlist properties and their respective Changed signals).

Property is basically the equivalent of parenting a server and a client script to the module with this one liner:

require(script.Parent)

Which is not hard to do but clutters the file browser.

Related issue or discussion

None, this is mostly made as a throwaway proof of concept. If this were to be added it'd probably need an enum to pick which contexts the module would autorun on (saw no demand for this one so I didn't bother with that).

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Tests
  • Build/export/tooling
  • Other

Area affected

  • Client
  • Creator
  • Server
  • Networking / replication
  • Scripting API
  • Scripting runtimes
  • Datamodel
  • UI / UX
  • Build / export
  • Other

Checklist

  • I have read the contributing guidelines
  • Added in-code documentation (where needed)
  • Ran dotnet restore
  • Ran dotnet format
  • Ran dotnet build
  • Ran dotnet test --project Polytoria.Tests/Polytoria.Tests.csproj
  • Tested the changes in a local environment
  • Ensured all commits are signed off

AI/LLM use

Claude was used for drafting, code review/cleanup, and troubleshooting. All code was manually reviewed and tested.

Signed-off-by: JustBorgar <134341430+JustBorgar@users.noreply.github.com>
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.

1 participant