How can I implement a Tween within my GUI? Please help

Alright so I guess I would say it kind of worked but i want it to be like the gui example that i sent, or similar to it, if thats possible, but there are still some issues. I recorded it, so ill just send it to you

1 Like

look like the size also needs to be tweened, sorry i forgot about that. Maybe try @TheMrShowerMan’s solution, it might work better.

1 Like

Just to clarify, do I put this script into my ShopButton?

Alright, thanks for your efforts, I appreciate it a ton :slightly_smiling_face:

1 Like

Also do I replace the “Gui” the “shop” and the “button” with the names I have for them? Just an fyi my scripting knowledge is extremely limited

Can you send me a screen shot of how your ui is set up?

  1. Add a UIScale to the frame that should grow and set its initial scale to 0.
    image
    |
    image

  1. Сreate a local script under your button and enter the following script:
    image

Script

local TweenService = game:GetService("TweenService")

local UIScale = script.Parent.Parent.Frame.UIScale -- Way to your UIScale

local Enabled = false

local Animations = {
	ScaleEnable = TweenService:Create(UIScale, TweenInfo.new(.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
		Scale = 1
	}),
	
	ScaleDisable = TweenService:Create(UIScale, TweenInfo.new(.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
		Scale = 0
	})
}

script.Parent.MouseButton1Click:Connect(function()
	if not Enabled then
		Enabled = true
		
		Animations.ScaleEnable:Play()
	else
		Enabled = false
		
		Animations.ScaleDisable:Play()
	end
end)

Result

2 Likes

Alright, so this works, but is it possible that I can make it so when a player clicks out of it, it has the same animation but its out to in? Also I realized that the animation sort of breaks after you start clicking the shopbutton a few times. The animation affect sort of goes. Here is a recording:

it’s not. Looks like something wrong with your code, can u show it to me?

heres the script:

Do you only have this code in the UI or is there more?

Theres more but they shouldnt have an affect on this script’s function.

Can you open up the shop completely in explorer and show me, like this:
image

The LocalScript that is highlited is the script that I am using

Most likely the problem is in other scripts, can you show them? If not, then try to find the MouseButton1Click method in other scripts and erase it.

Wait, why do you have 2 UI Scales? Remove so that only 1 remains.

I don’t think i can spot this issue, assuming here the animation time is too low and it ends pretty fast compared to fps of this video so it just looks like it disappeared.

would def help if you try to change the easing style to linear and set time to 1 (confirming that there’s absolutely nothing wrong with the scaling cuz rn it looks more like a tween preferences)

I need those local scripts. The scripts are necessary for the shopbutton and frame

Most likely there is an error in them; it looks like you mistakenly set the Visible of the main frame to false.


Where do I change the time