The other day, I was reading some old Roblox scripts from a template and I came across this line:
Player:RequestStreamAroundAsync(FocalPoint)
What exactly does this function do? The documentation didn’t exactly make a whole lot of sense to me, and I couldn’t find any topics further explaining this.
If you can clarify what this does, please let me know! Thank you and have a wonderful day!
In-experience instance streaming allows the Roblox engine to dynamically load and unload 3D content and related instances in regions of the world.
Instance streaming (or streaming enabled) is basically loading to the client only the areas in a certain radius from the player (based on your streaming settings) with regards to the device’s available memory. (If your streaming type is set to LowMemory)
What Player:RequestStreamAroundAsync(FocalPoint) does is that it requests to stream (load) the areas around FocalPoint (which is a position in the world) to the player.
One thing, though: what’s the point of Instance Streaming? Is it like loading specific instances and areas onto the client to avoid overwhelming the server on low-end devices?
There are a few reasons to use streaming, it allows you to create big worlds and not have the whole world load at once for the player, reducing join times and out-of-memory crashes.
You would most likely notice a difference with assets far away from you in the workspace. They might exist on the server and not on the client. That is because they were streamed out, which is normal.
Make sure you follow the best practices if you do decide to have it on:
You can see in the image above for example, that when you move a player’s character by setting it’s CFrame, you should do so from a server script, and use Player:RequestStreamAroundAsync to load the area around them.