There’s a problem where if you have too much imagelabels in a scrollingframe, your fps drops when you scroll.
This is my set up: (Menu (frame) → Characterscrolling (scrollingframe) → imagelabels under this scrollingframe)
Solution is probably to only make visible the ones on the user’s screen, but make the rest invisible. I need insight on how to do this with scrollingframe?
1 Like
I don’t know why it lagging. I used to make a GUI and had similar amounts of imagelabs and scroolingframe but I didn’t have lags. Maybe try lowering the image resolution a bit.
1 Like
Did you have more than 1,000 imagelabels?
Even so, I want to know how to only show the labels that the user is viewing and making the rest invisible.
1 Like
This should help you out:
function isClipped(uiObject)
local parent = uiObject.Parent
local boundryTop = parent.AbsolutePosition
local boundryBot = boundryTop + parent.AbsoluteSize
local top = uiObject.AbsolutePosition
local bot = top + uiObject.AbsoluteSize
local function cmpVectors(a, b) -- Compare is a is above or to the left of b
return (a.X < b.X) or (a.Y < b.Y)
end
return cmpVectors(top, boundryTop) or cmpVectors(boundryBot, bot)
end
game["Run Service"].Stepped:Connect(function()
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Frame") then
if not isClipped(v) then
print("visible")
v.Visible = true
else
print("invisible")
v.Visible = false
end
end
end
end)
2 Likes
Thank you. Trying to put this script in, what is ‘script.Parent’ is that a scrollingframe?
Then in the clipped function what is the uiObject.Parent is that the scrollingframe?
3 Likes
script.Parent is the scrolling frame
v is the frame
1 Like
Thank you. The script works. Only problem now is that the scrolling bar disappears due to the absolutecontentsize script below
which causes the scrolling frame to adapt.
so because the the frames under the scrollingframe are invisible i can’t scroll down to make the others visible due to the adapter.
If i remove the code: it doesnt scale according to its contents
1 Like
change it so transparency changes and not the visibility
2 Likes
will the transparency help with the fps drop that’s caused by 1000+ imagelabels in the scrollingframe?
1 Like
Objects are not rendered if they are outside the bounds of either the screen, or the closest ancestor with ClipsDescendants
being true. This script would also interfere with being able to use the Visible property normally on all of those frames.
1 Like
what do you suggest to be done?
1 Like
There are too many ImageLabels. I suggest removing some. No matter what you do, there are still too many to handle.
1 Like
Games like bee simulator dealt with stuff like this, so I’m sure there’s a solution out there
1 Like
https://gyazo.com/626b139f8687c534f6798e52036b9c70 It seems that it keeps turning visible even though its in view
1 Like