I made three different frames, two with buttons. The buttons are supposed to make the third frame move towards them. Although the GUI moves, it only moves to ayy.Position, even though I clicked on the other GUI.

This is the script under one of the frames with the buttons:

local plr = game:GetService("Players").LocalPlayer 
local gui = plr.PlayerGui:WaitForChild("THING")

 

script.Parent.MouseButton1Click:Connect(function()

 
    gui.Moving:TweenPosition(UDim2.new(gui.ayy.Position), "Out", 4)

    wait(1)

end)


--THING is a screenGui, Moving is the Gui that is supposed to move, and ayy is the gui it's supposed to move to

This is the other:

script.Parent.MouseButton1Click:Connect(function()
	
	
	local plr=game.Players.LocalPlayer
	
	local gls=plr.PlayerGui:WaitForChild("THING")
	
	gls.Moving:TweenPosition(UDim2.new(gls.Oot.Position), "Out", 4 )
end)
--THING is a screenGui, Moving is the Gui that is supposed to move, and Oot is the gui it's supposed to move to