Being streamed out when trying to set camera CFrame

I’m setting camera CFrame to this treasure position. I’m setting the focus of the camera either to the character primary part or the treasure, but RANDOMLY, whenever Roblox decides I guess, I am streamed out and CFrames turn into nans and my focus is thrown off, my entire character is streamed out as well as my surroundings, gameplay gets paused, etc. This is the most confusing problem I have ever had on Roblox, and it has to do with StreamingEnabled. Someone please tell me this isn’t a bug. I am using typescript so I will provide both the typescript and the lua versions (lua will be cut up a bit so as to not look horrible). Please excuse the bad code as I am also extremely stressed and feeling like I’ve tried everything putting in patches all over the place. So here goes nothing.

You will see on the first treasure I dug up the cutscene worked perfectly. However you will see the problem occur on the second treasure and I explained exactly why it’s happening. I set CameraType to Scriptable and just set the CFrame to the treasure.
TS Code: code.ts · GitHub
LUA CODE: code.luau · GitHub

VIDEO WHERE ISSUE OCCURS: Watch Streaming issue? | Streamable

And I am 100% positive the issue occurs here in the code I have provided!
My streaming options are as follows:
StreamOutBehavior: Default
StreamingMinRadius: 128
StreamingMaxRadius: 1024
ModelStreamingBehavior: Default

I’m surprised the player character is being streamed out. I don’t think I’ve had an issue with that. For the camera though, are you using a reference to a part? If so, fixing the part streaming out, you can put it in a Model and change the ModelstreamBehavior to Persistent, which stops it from streaming out. That’s what I do for camera-related parts in my game.

There’s also that tries to stream in things in the area around where the want it (not 100% of the time though):

local success, result = pcall(function ()
	return 	player:RequestStreamAroundAsync(CFrameToSet)
end)
1 Like

This is on the client, so this will not work. All Im doing is moving the camera on the client and setting it to scriptable. Nothing else changes, and basically the treasure is right next to the player too.

You should set the Character model to Enum.ModelStreamingMode.PersistentPerPlayer then ModelInstance:SetPersistantPlayer(player) Also, make sure streaming behavior is set to improved.