Tween support for my shop GUI

I was trying to create a tween for a shop gui I was making and every time I clicked the button an error would show up in the output. It would say “Unabled to cast string to token.” Here is my script:

local Button = script.Parent.ImageButton

Button.MouseButton1Click:Connect(function(player)
	Frame:TweenPosition(UDim2.new(0.258, 0,0.163, 0),"Out","Bouncy",1)
		
	
end)

Does anyone know what is wrong with this script?

Perhaps try this?

Frame:TweenPosition(UDim2.new(0.258, 0, 0.163, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Bouncy, 1, false, nil)

You don’t need to place player there as its a local script|

Edit:

Change

Button.MouseButton1Click:Connect(function(player)

To

Button.Activated:Connect(function()
1 Like

Oh yeah and remove player from this line:

Is the script inside the Button, were the Tween should play when Clicked?

That isn’t the problem here, the problem is with the tween.

1 Like
local Button = script.Parent.ImageButton

Button.MouseButton1Click:Connect(function(player)
	Frame:TweenPosition(UDim2.new(0.258, 0,0.163, 0),"Out","Bouncy",1)
end)

String’s aren’t recommended when you can use Enums. Can you try Frame:TweenPosition(UDim2.new(0.258, 0,0.163, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 1)

1 Like

You would have to change Enum.Direction.In to

Enum.EasingDirection.In