What do you want to achieve? I want to reposition a Frame with tweenposition.
What is the issue? Include screenshots / videos if possible! The tween function fires but the frame doesn’t move to the correct position on the screen. (it doesn’t move at all but i have to wait for the tween to finish)
What solutions have you tried so far? Iv’e googled about tweens, added wait() tried breakpoints, added function callback to see if the method fires, changes positions, tried sizePosition tween.
Any clue what I might miss?
Here is how the code looks like:
local isOpen = false;
local positionClosed = UDim2.new(0, 0, 1.505, 0);
local positionOpen = UDim2.new(0, 0, 1, 0);
local mainFrame = script.Parent.Frame;
local toggle = script.Parent.Toggle; -- Is just a UI button
toggle.MouseButton1Click:Connect(function()
print("Toggle Clicked", isOpen)
if isOpen then
mainFrame:TweenPosition(positionClosed, Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1, false, function() isOpen = false end);
else
mainFrame:TweenPosition(positionOpen, Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1, false, function() isOpen = true end);
end
end)
According to this documentation this should suppose to work
If your frame doesn’t move to the correct position, that implies that your frame is moving and that you would only need to tweak a few values.
I copied your script into a testing world and it worked perfectly fine, the only issue being that it can only be pressed once, as your positionClosed is 1.505, normally off screen unless everything was nested within another frame.
Based on your wording, it appeared like you meant that TweenPosition wasn’t moving the frame at all.
You are correct about its going offscreen, Its a cutdown version of my whole UI and there used to be a button above that frame which stays in screen haha.
I know that the tween finished playing because the arrow of my toggle changed. I cannot click the arrow when the tween is playing. so there is a good second I have to wait before I can test again which tells me the “cooldown” of the tween fires too. The isOpen bool also changes on click, its the position 0,0,1,0 which won’t fire