Scripting a Button to Tween a frame to two positions [attempt to index nil with Parent]

I want to make it so :

There is just one Gui Button that tweens a frame from point B to A

and if the frame is already at point A , then it will tween it from A to B instead.

[SOLVED (By myself)]

Here is was the error

image
**EDIT : Nevermind guys, I fixed it on my own, thanks anyways (whoever’s reading)

I corrected my code :

script.Parent.Parent.Visible=true

script.Parent.MouseButton1Click:Connect(function()


	
	local buy = script.Parent.Parent.buy
	
	local open = script.Parent.open--Bool Value      
      
 if not open.Value==true then
	
	
	script.Parent.Parent.Parent.Song:Play()
      open.Value=true
 buy:TweenPosition(UDim2.new(-6.57, 0,0, 0), 'Out','Elastic',0.7)
      print("set to true")
	return end--_1
	
	buy:TweenPosition(UDim2.new(2, 40,0, 0), 'Out','Quad',1)
      
	  open.Value=false
 
  end)