I have problems with scrollingframes… i make a Pet System and if i have 200 Pets+ in Scrollinframe it laggs i have in the pet frames a viewportframe for pet view a localscript for click function select and yea 1-2 other frames in it
At 200 Pets if i scroll 30 fps instead of 60
At 500 if i scoll 10-20 fps instead of 60
And no i dont have a bad pc
idk how to fix it i mean less lagg
i tried to only show pets that are in your view but idk how to make it
i hope anyone can help me
I mean if the 200+ pets are frames I’d understand that it lags…
You could try halfing it and have another page a player can click onto, When the player clicks onto that page you could clone the frames into replicatedstorage but delete the other clone so there is only 1 clone.
Then when the player clicks the back button you could clone the frames from replicatedstorage into the ScrollingFrame.
I dont want pages…
and if its in replicated and i clone everything in it laggs more…
i want to know how to remove all that not in your visible in scrollingframe bgs made it like that
Is every pet a ViewportFrame?
If so, you could add a calculation to see if the pet frames are colliding with the ScrollingFrame that they are in, and if they are NOT touching, make them not visble
function collidesWith(gui1, gui2)
local gui1_topLeft = gui1.AbsolutePosition
local gui1_bottomRight = gui1_topLeft + gui1.AbsoluteSize
local gui2_topLeft = gui2.AbsolutePosition
local gui2_bottomRight = gui2_topLeft + gui2.AbsoluteSize
return ((gui1_topLeft.x < gui2_bottomRight.x and gui1_bottomRight.x > gui2_topLeft.x) and (gui1_topLeft.y < gui2_bottomRight.y and gui1_bottomRight.y > gui2_topLeft.y))
end
if collidesWith(petFrame, scrollingFrame) then
petFrame.Visible = true
else
petFrame.Visible = false
end