My button for tweening no longer works

So, I wanted to make a gui tween up and the problem is that, when I wrote the code for the button, the gui didn’t tween at all. And I’ve used this code many times before. Here’s the code:

script.Parent.MouseButton1Click:Connect(function(clicked)

script.Parent.Parent.Parent.level1:TweenPosition(UDim2.new(0, 0,-5, 0))

end)
1 Like

For tween position you would need

:TweenPosition(Position, Direction, EasingStyle, Time)

You only filled one of them

Also check if there is any errors in the output.

1 Like

I checked the output and there were no errors.

They don’t necessarily have to error, you need to pass the arguments.

I tried and it still doesn’t tween.

In your :TweenPosition you’re tweening the UI to the bottom, does it disappear? It might be tweening to fast because you didn’t fill the time.

No, I’m trying to tween it up. And no, it doesn’t disappear, it just does nothing.

Make sure you’re not tweening a screen gui. Also instead of MouseButton1Click you should do .Activated instead

script.Parent.Parent.Parent.level1:TweenPosition(UDim2.new(0, 0,-5, 0), "Out", "Quart", 1)

Try this

I tried it and it still does nothing. Did roblox just break the code?

Is that all of the code in the script? Make sure it’s a local script.

It’s in a local script. I always put gui code into a local script.

Is there any wait(), or any loops in the local script? If not I can’t think of a solution

Nope no loops and no waits. I think Roblox might have just broken the code. Cause I always use this code and it always works.

1 Like

Ok so I just found out that for some reason, the code doesn’t work in studio but it works in game. Man, Roblox is broken sometimes.

Put this in your Button make sure its TextButton add Local Script in it and use
script

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.level1:TweenPosition(UDim2.new(0, 0,-5, 0),“Out”,“Quad”,0.5)
end)

These scripts arent supposed to work in studio…
At least you solved your issue

But they should work in play test mode.