The buttons are inside of the level frames.
you should probably change the layering of the layers
also, convert your scaling of your template frames to offset through code (use offset on scrollingframes is the only way they will work, i prefer scaling on the template then convert it when the game is running)
another thing to use is UIPadding, it’s a game changer for padding for all ui elements
here’s a code example
-- define this in a function so it doesn't remain static and end up constantly adding itself
for ... do -- make sure to have some sort of number iterator
-- make sure to use offset in scrolling frames, it has issues otherwise
-- in your loop
local new_template = ... -- clone
new_template.ListOrder = i
new_template.Parent = ScrollingFrame
if yAxisSize then
new_template.Size = yAxisSize
end
new_template.Parent = ScrollingFrame
if not yAxisSize then
yAxisSize = template.AbsoluteSize -- i opted to just set offset as the absoluteSize to save time but it's up to you whether or not you want to use both scaling and offset
template.Size = UDim.fromOffset(yAxisSize.X, yAxisSize.Y)
end
if yAxisSize then -- this conditional basically makes sure that all this logic was applied before updating the canvasSize
scrollingFrame.CanvasSize = UDim.fromOffset(0, (yAxisSize.Y * i) + ((i - 1) * UIListLayout.Padding.Y.Offset)) -- i set the x size to zero since I don't really see a use for sideways scrolling but your milage may differ
-- i should also mention that i used i - 1 because you shouldn't account for extra padding on the scrollingframe
-- also, don't use scale for padding as well since many inconsistencies can happen. a general rule of thumb is that offset is the only thing you should use in scrollingframes (or with UIConstraints in general)
end
end
then im pretty sure you can use your code you used before that made it absurdly large
i know it sounds like a stupid change, but trust me, it makes a HUGE impact.
What would I put as the iterator, and what would the template be?
the template is whatever you clone to make the admin panel, and then you’ll want to iterate through the data you used. if you don’t use this method of creating ui you might want to check it out, i have more information here:
I have 4 frames which hold their button and dropdown. I use a textlabel called template to add the command list, is that what you’re talking about? Could you also elaborate on what data is? Is there an easier way than this code that I don’t understand?
Hierarchy:
Generally what you’re going to want to do is have a data structure that contains frames for each part of the UI
You’ll have your Players that contain the commands, which are templates that you clone, instead of manually creating them in the UI Editor
ScrollingFrame
|--|- Frame: Template, this is used for containing the buttons for the commands and players
|--|--- Button: that is clicked to make all the commands visible
|--|--- Frame: Contains the commands which also are a template, you'll resize when the button is pressed of the frames
|--|--|--- Command: Another template, a text button that fires the command to the server
You will want to store the templates inside the LocalScript and parent each one to the frames.
I generally like to have a ModuleScript that contains all the commands.
return {
{ Name = "viewlogs", ... }
}
That’s what I do anyways. I take a template, clone it, and set its text based on the command name. I parent it in pairs with its level and the name. For example, I have a command with level 2. That would go under admin
.
All I need help with is the weird resizing whenever I scroll on the button.
Yeah, so what I’m saying is that you’re going the want use offset
instead of scale
.
You can keep the scaling in studio but change it to offset
when you’re cloning it.
As of right now, ScrollingFrames do not play with scale
.
I know it sucks that way, but that’s just how roblox is. Luckily, you don’t need to change every descendant of the scrolling frame to offset
, just the direct children.
Make sure you also change the size of the frame as well so the other frames move.
Ohh I see. Is there a plugin that can convert scale to offset easily?
You have to do it yourself, it’s pretty simple.
You should use scale when you make it in studio, just not during runtime.
Scale is better in studio, but once you clone the Templates, you’re going to use the AbsoluteSize for the template, make sure you use Scale for the X axis.
Basically, whatever axis you want to scroll on, you need offset.
Otherwise, you can just use scaling.
I posted a code example earlier, you can use it as a reference. Let me know if you have an questions
Can you remind me what I’m converting here, and is it size or position?
Size for the Y, but position is handled by the UIListLayout. You’ll only change size based of the AbsoluteSize property after it is parented
But what to, the container, the textlabel template?
Basically, the Frame that holds all your stuff is the thing you need to resize.
You just change the first child of the scrollingframe to offset and everything else will scale accordingly to that frame’s offset under it.
Scale is basically a percentage of how many pixels the parent frame is. Offset is just pure pixels.
However, children that use scale and canvassize in the form of scale does not play well with ScrollingFrames.
Probably because you’re using scale on the y axis instead of offset. Use offset instead.
I have, and gotten the same result.
Like I said, if there’s a ScrollingFrame, use offset.
And also make sure to use offset for the CanvasSize
What do I use offset on?
thirty
Nevermind, I give up. Thanks though.
Offset for Scaling and Position (if you’re not UIListLayout)