Streaming part problem with Infinite Obby Generated

I has problem streaming part with obby generator
First when play game of long obby without laggy and camera turn around make slow down with too many part and laggy its see picture:

I look up no lag problem and look down too lag too many part with streaming enable.

Above:

Middle:

Below:

I need help get rid of lag.

1 Like

Have you tried changing the Properties of StreamingEnabled by decreasing the StreamingTargetRadius?

Yea. But still problem below make laggy

See example of streaming target radius:






There problem with streaming part still stand lot laggy from below of infinite obby generated.

I’ve actually been working on a game of my own with a similar concept to this, and in that project I generate each level individually, one at a time. The player steps on a blue pad and it generates the first level, as well as a checkpoint at the end. Each checkpoint then generates the next level.

Behind the player, old levels gradually degenerate in order to reduce lag.

I don’t know if this would work for your specific game, but if part lag is the issue, maybe the best solution is to just have less parts all at once.

2 Likes

oh. see
I think runtime script:


and there script run slow down of inside a platformer after infinite clone model or streaming target radius.

And below cause too laggy. See above of picture on first post.

My obbies

and Generated script

local Current = workspace.Obbies
local Obbies = game.ReplicatedStorage.Obbies:GetChildren() -- getting the current obbies
local StartingPos = CFrame.new(-23, 99.5, 0) -- where the 1st part will be.
local MaxObbies = math.huge -- the obbies it generates(math.huge = inf)
local Rng = Random.new() -- rng for generating the obbies
wait(1)
local function Add(Obby) -- function for adding the obbies
	local NewName = #Current:GetChildren() + 1
	Obby.Name = string.format("%.f", NewName) -- names the obby
	if Obby.Name == "1" then -- if this is the first obby generated
		Obby:PivotTo(StartingPos) -- moves the obby into the starting pos
		Obby.Parent = Current -- parents the obby so we can see it
	else -- if it isn't the first obby generated
		local LatestObby = Current:FindFirstChild(string.format("%.f", #Current:GetChildren())) -- gets the latest obby generated
		if LatestObby then			
			Obby:PivotTo(LatestObby.End.CFrame) -- moves the obby to the latest obby's end part cframe
			Obby.Parent = Current
		end
	end
end
for i = 1, MaxObbies, 1 do -- this will repeat the code between the for and the end based on the max obbies value
	local RandomNum = Rng:NextInteger(1, #Obbies)  -- gets a random integer(whole number, no decimals)
	local Obby = Obbies[RandomNum]:Clone() -- gets an obby inside the obbies folder with the random number
	if Obby then
		Add(Obby) -- adds the obby
	end
	task.wait() -- not to crash the game
end

I working on my game of Infinite Obby Generated.

1 Like

use a client sided :Destroy() on models outside of a radius, or once the workspace has x models delete the oldest one, using a list to keep track of the models. Use .ChildAdded on the workspace and add the model to the end of a list, and once that list’s length is greater than 10 for example, destroy the oldest model and remove it from the list. iirc streaming won’t remove instances until some cap is filled up but I’ve never used it.

Where put script, if model outside of a radius?
I think cant know to how work :destroy with model number in obbies folder.

Script code:

Write here of destroy on model outside of a radius

Where put script?

Generated obby look like Nibbler Arcade
Roblox obby example

I see you’re having problems with not only the Obby but with game optimization. Keep in mind that generating infinite obbies/stages (Which basically makes sense) will lag your game alot. Mainly if the Stages/Obbies contain alot of parts. For that, I recommend you taking a look at Janitor Module & Maid Module for storing Instances/Events (Or Connections), Changing your game’s PhysicsSteppingMethod to “Adaptive” (Can be done via Workspace > Behavior > PhysicsSteppingMethod > Adaptive)

And the most important part is to not make the number of Obbies/Stage infinite, Maybe try making it something around 100 ~ 1000 If you want alot of Stages.

I get it.
Roblox Stage
A ‘Stage Line’, When player go on and Generated/Degenerated obbies around 100. After generated is stop on around 1000.
Its working, no lag problem.