Gui Script Problem

So this is probably a dumb problem, but I am unable to change the GuiObject size using my script. Perhaps there’s a mistake in my script, I just don’t know. Please help, thanks!

Script:

local teams = game:GetService("Teams")

local teamnum = teams:GetChildren()

local scrollingFrame = script.Parent.Parent.Parent.ScrollingFrame

local lastPos = -0.118

for i = 1, #teamnum do

local teamButton = Instance.new("TextButton", scrollingFrame)

teamButton.Size = UDim2.new(0,198,0, 50)

teamButton.Position = UDim2.new(0,0,lastPos+0.118,0)

lastPos = lastPos+0.118

wait()

end

Intended Size:
Gui%20Problem%20(Intentions)
Resulted Size:

Gui%20Problem%20(Result)
Explorer:
Gui%20Problem%20(Explorer)

This is pretty obvious. Your Y size is a offset, but your Y position is a scale.

4 Likes

Sorry, I’m confused. So, how would I fix the problem?

Switch your two last parts of your position property

1 Like