Error with Gui Tweening

Objective:
Fix My Mistake with my Gui Tweening Script

issue:
" Players.56ytr56.PlayerGui.inventory.TweenScript:14: attempt to index function with ‘TweenSizeAndPosition’"

Research:
using previous code that has worked, literally 2 lines above it works
(this also happens at line 20)

local gui = script.Parent
local frame = gui.ScrollingFrame
local frame2 = gui.remove
local button = gui.button
local toggle = false

button.MouseButton1Up:Connect(function()
    
    if toggle == false then
	    toggle = not toggle
		button.Text = "Close Inventory"
    	frame:TweenSizeAndPosition(UDim2.new(0, 200, 0, 250), UDim2.new(0.005, 0, .411, 0))
    	wait(1)
   	frame2:TweenSizeAndPosition(UDim2.new(0, 50, 0, 50), UDim2.new(.193,0,.311,0))
    else
    	toggle = not toggle
	    button.Text = "Open Inventory"
	    frame:TweenSizeAndPosition(UDim2.new(0, 200, 0, 50), UDim2.new(0.005, 0,0.311, 0))
	    wait(1)
	   frame2:TweenSizeAndPosition(UDim2.new(0, 50, 0, 50), UDim2.new(0.14, 0,0.311, 0))
	
   end
   end)

Try using WaitForChild() on the variables:

local frame = gui:WaitForChild("ScrollingFrame")

though i do wonder why it acts like i’m trying to make it do gui:Connect which would error it instead of a error on somthing more on the gui front like,
PLayers.56ytr56.gui.Tweenscript:14: attempt to wait to short of time before another tween