Tweening Frame doesn't work

So this might be a stupid question for most of you but for some reason my script isn’t working and i don’t see why, any idea how i would fix it ?

local player = game:GetService("Players").LocalPlayer
local frame = game.StarterGui.ScreenGui.Frame

script.Parent.MouseButton1Click:Connect(function()
	frame:TweenPosition(UDim2.new(0.386, 0, 0.477, 0), "Out", "Back", .6, false)
end)```
1 Like

Try setting frame as:

local frame = player:WaitForChild("PlayerGui",10):FindFirstChild("ScreenGui").Frame

Edit: Not StarterGui, I meant PlayerGui.

3 Likes

try printing the frame and see if it returns what you want, Does the output says anything?

1 Like

Try changing this to

frame:TweenPosition(UDim2.new(0.386, 0, 0.477, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,.6,false)
2 Likes


creates this error

1 Like

It’s saying the frame doesn’t exist, you could try :FindFirstChild(“Frame”)

1 Like

Oh also I just realized the way you reference frame try using a LocalScript and put it inside the frame and replace it to local frame = script.Parent

1 Like

would i need a RemoteEvent so i can use the variable inside of the LocalScript inside of TextButton? Or would it just be easier putting the whole LocalScript inside the frame and adapting it?

1 Like

I might have found the issue actually, but i have no idea why this happens

1 Like

Yes it could be easier give it a try.

2 Likes


The Frame shows now, only problem is that even if i changed the endPosition value it goes in a corner of the screen

1 Like

Try code as

local player = game:GetService("Players").LocalPlayer
local frame = script.Parent
local TweenService=game:GetService("TweenService")

frame:TweenPosition(UDim2.new(0.386, 0, 0.477, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,.6,false):Play()

Maybe work with tween position?

1 Like

Same problem with the position always being at a corner of the screen but it also made this error

1 Like

Sorry. remove the :Play()

replace:

local player = game:GetService("Players").LocalPlayer
local frame = script.Parent
local TweenService=game:GetService("TweenService")

frame:TweenPosition(UDim2.new(0.386, 0, 0.477, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,.6,false)

Try again test it.

1 Like

Here:

local player = game:GetService("Players").LocalPlayer
local frame = script.Parent.Parent.Frame
local TweenService=game:GetService("TweenService")

script.Parent.MouseButton1Click:Connect(function()
	frame:TweenPosition(UDim2.new(0.386, 0, 0.477, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,.6,false)
end)

Try. test it. If work with tween position with click button.
robloxapp-20220308-1239306.wmv (224.1 KB)

1 Like

Its still does that thing with getting in a corner, whats your frame’s position before clicking the button?

1 Like

Its still does that thing with getting in a corner, whats your frame’s position before clicking the button?

Yes

1 Like

I test of tween position.
robloxapp-20220308-1331200.wmv (341.3 KB)
TweenPosition.rbxl (40.7 KB)
Its working. Frame up and down with click button.

1 Like

robloxapp-20220309-0537092.wmv (607.0 KB)
It’s just the same problem, it goes into the corner of the screen for no reason when i customize it

TweenPosition2.rbxl (40.7 KB)
Just open and close button goto up and down.
I test and worked fine.