StampService: Easy Atomic Steaming Replacement

It can be hard to program collections of instances with streaming enabled because there are many potential cases to try and handle. In the case of a computer screen, keyboard, and mouse, for example, there are 8 different cases (from streaming enabled alone!) to handle. For only a collection of only 3 Instances. The number of cases increases exponentially from there.

StampServiceIcon (1) StampService
This is where the StampService comes in handy. Many developers already use the CollectionService and its tags to allow code to identify collections of instances being added and removed (aka the binder pattern).

The StampService wraps the CollectionService on the client and only has one new method: :AddNewStamp(tag, requirements). (This function can be called at any time, no two step stuff or problems with order of execution.)

Example Requirements Table

(For computer example)

	Screen = {
		SurfaceGui = {};
	Mouse = {
		RightMouseButton= {
			ClickDetector = {}
		LeftMouseButton= {
			ClickDetector = {}
	Keyboard = {
		ClickDetector = {}

:AddNewStamp takes two arguments: the tag (string) of the stamp and a table representing the requirements/dependencies of the stamp. The InstanceAdded signal will only fire once all the requirements are added and the InstanceRemoved signal will fire when any requirement is removed.

This makes it so client-sided streaming enabled code doesn’t need to handle cases where instances aren’t there because it can assume that after InstanceAdded fires all the instances it needs are there.

GIF Demonstration
StampService Demo
A healing area is shown above. The server heals all players within the pillars. The client animates the beams between the pillars depending on if the character is inside the pillars. The beams tween to dark blue-green when the HealingArea object is destroyed or when the player leaves the healing area.


There are some caveats with this:

  • Required instances can’t (or at least probably shouldn’t) have siblings with the same name
  • Has two dependencies: Signal (might get rid of signal to make it simpler) and Trove (Trove is basically Maid/Janitor/Dumpster)
  • Roblox might be making a solution to this problem:

Another thing that really interests me with this is that games that don’t use streaming enabled that use the binder pattern can super easily switch their game to streaming enabled by wrapping the CollectionService.

I’m going to be doing some more testing before I release post this on #resources:community-resources. I’m curious if anyone is interested in this or has any questions/concerns.


This is pretty neat, I made something similar ScreenVerticiesService it gets the “vertices” of an object and returns if it’s on screen or not, this with a simple magnitude check will decide if an object should “exist” given the player’s position and camera position :+1:

1 Like