Tweening Issue with frame

Tweening, I made a frame and when you press the button it works and it tweens (slides up), perfectly but one problem. When you go and press the X button it doesn’t tween, it turns off but it doesn’t tween (slide down). Any suggestions or fixes? Thanks. (No errors)

Close Script

-- Variables --
local storeFrame = script.Parent.Parent

-- Scripts --
script.Parent.MouseButton1Down:Connect(function()
	storeFrame.Visible = false
	local frame = script.Parent.Parent
	frame:TweenPosition(UDim2.new(0.255, 0,1.145, 0))
end)

Open Script

storeButton.MouseButton1Down:Connect(function()
	storeFrame.Visible = true
	local frame = storeFrame
	frame:TweenPosition(UDim2.new(0.255, 0,0.145, 0))
end)

Did you get any errors? You should always include errors, if any, to help solve your problem

No, there’s no errors when I run the game.

Have you checked its position in the properties tab to see if it actually tweened?

Yes, I changed the frame’s position to (0.255, 0,1.145, 0))

Aren’t you setting visible to false before you tween it?

storeFrame.Visible = false -- here
local frame = script.Parent.Parent --- sane frame as storeFrame
frame:TweenPosition(UDim2.new(0.255, 0,1.145, 0)) 

so moving this: storeFrame.Visible = false after the tween might fix the problem

local frame = script.Parent.Parent 
frame:TweenPosition(UDim2.new(0.255, 0,1.145, 0)) 
storeFrame.Visible = false

you might have to add a wait too

wait(Number)
storeFrame.Visible = false

Then nothing is wrong: it’s actually tweening. You’re just changing the visible property to false before the tween can even start. You can use this:

local frame = script.Parent.Parent
frame:TweenPosition(UDim2.new(0.255, 0, 1.145,0), "Out", "Quad", 1, true, function() 
    storeFrame.Visible = false
end) 

Hmm, I actually just had to delete storeFrame.Visible = false from the script and it worked.