But, I have multiple frames inside of “holderButtons” and want to know if there is a more efficient way to do this, without using a for loop? Theyre all the same size so that shouldnt be an issue.
-- Connect to MouseEnter event of holderButtons
holderButtons.MouseEnter:Connect(function()
adjustFrameSize(holderButtons, true) -- Increase size
end)
-- Connect to MouseLeave event of holderButtons
holderButtons.MouseLeave:Connect(function()
adjustFrameSize(holderButtons, false) -- Decrease size
end)
-- Function to adjust size of child frames
function adjustFrameSize(parentFrame, increase)
local increment = UDim2.new(0, 0, 0.02, 0)
if not increase then
increment = increment * -1
end
for _, childFrame in ipairs(parentFrame:GetChildren()) do
if childFrame:IsA("Frame") then
childFrame.Size = childFrame.Size + increment
end
end
end
As the person above did, you should be able to connect the MouseEnter directly to the holderButtons frame, then scale it [holderButtons] accordingly, which should scale all child frames.
However, if that is what you want, please elaborate on why you don’t want a for loop?
local p = game:GetService('Players').LocalPlayer.PlayerGui.ScreenGui
for _,button in p:GetChildren(), next do
if typeof(button) ~= 'Frame' then
-- do stuff here
end
end
something like this, or u can do it directly in the loop
local p = game:GetService('Players').LocalPlayer.PlayerGui.ScreenGui
for _,button in p:GetChildren(), next do
if typeof(button) ~= 'Frame' then
assign(button)
end
end
function assign(n)
n.MouseEnter:Connect(function()
createTween(holderButtons.ChangelogFrame, "Size", holderButtons.ChangelogFrame.Size + UDim2.new(0,0,0.02,0), 0.05)
end)
end