Issue with having a scroll UI NOT blank. (Blank = fine, Not blank = errors)

Hey guys, so basically I am trying to make a UI that is supposed to fill up with chatlogs.
My issue is that when I use the command; If there are NO previous chatlogs, it’ll go on fine, empty as it’s supposed to be.

However, attempting to do the same thing when there’s some chat, it’ll error.

What SHOULD actually happen: (Same UI and the same script for the building of the UI. For some reason, however, it doesn’t error here.)
image

So far I have no solution over it at all, and it’s the first time it has occured to me. Could it be possible it’s because my script is more than 3K lines? Or is another issue? Because as far as I am concerned, pos isn’t a boolean, nor is the UI position.

        local clone = player.PlayerGui.MainUI.ListUI:Clone()
        local pos = 0
		clone.ScrollingFrame.command.Visible = false
		local newt={}
		for i = 1, math.floor(#chatlogs/2) do
			local j = #chatlogs - i + 1
			newt[i], newt[j] = chatlogs[j], chatlogs[i]
		end
		for i,v in pairs(newt) do
			pos = pos+1
			local bar = clone.ScrollingFrame.command:Clone()
			bar.Parent = clone.ScrollingFrame
			bar.Text = v
			bar.BackgroundTransparency = 1
			bar = true
			bar.Position = UDim2.new(0.03,0,0,(pos-1)*28) -- The erroring line.
			clone.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,(pos-1)*28) -- I have a feeling this will error too, since it uses the same function.
		end
		clone.Parent = player.PlayerGui.MainUI
		clone.Title.Text = "Chatlogs"
		clone.Visible = true
1 Like

You set bar to true and then indexed it with Position.

3 Likes

Oh god. I can’t believe I actually missed this.
Many thanks for pointing this out. Maybe that’s what happens when you cry for a week straight and wake up on the next morning trying to dev.
That variable was supposed to be bar.Visible = true btw.