Tween does not go to location

local btn = script.Parent
local player = game.Players.LocalPlayer
local tweenedFrame = game.StarterGui.Tweening.Frame

btn.MouseButton1Click:Connect(function()
	if btn.Text == 'SHOP' then
		btn.Text = 'Close'
		tweenedFrame:TweenPosition(UDim2.new(0, 164, 0, 104), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5)
	elseif btn.Text == 'Close' then
		btn.Text = 'Shop'
		tweenedFrame:TweenPosition(UDim2.new(0, -900, 0, 104), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5)
	end
	
end)

what is going on?

Maybe that’s because you wrote Shop in capital letters?

The reason it doesn’t work is you are defining the frame in StarterGui. You should use instead

script.Parent.Parent.Tweening.Frame

or whatever how many parents there are.

@CoolGuyBoiBruh Unless you add this because it is necessary. However, the frame is parented to the PlayerGui folder of the player, not StarterGui.

1 Like

make sure that the item(s) you are moving, make their position {0,0,0}

This is a gui, it requires UDim2, not a Vector3 or whatever

No, frames’ position contains a UDim2 value.

is this a client or server script

This script is a client script.

then do playergui not startergui playergui makes it run for only the player

local tweenedFrame = game.PlayerGui.Tweening.Frame

Bro, you were right, At this line you can see i I said ‘Shop’ when I should have said SHOP. I just misspelled the word. Thanks!

that wouldnt work. you would have to get the local player then the player gui. the game can not directly access that.

1 Like