Getting an error when correctly coding a GUI tween? (According to Roblox Developer Hub)

Hey everyone! So I get an error, more specifically:

  16:41:53.044 - Unable to cast token to token
16:41:53.045 - Stack Begin
16:41:53.046 - Script 'Players.MaximussDev.PlayerGui.Jump.LocalScript', Line 5
16:41:53.046 - Stack End

whenever I try to use this script:

script.Parent.Jump.MouseEnter:Connect(function()
	script.Parent.Jump:TweenSizeAndPosition(UDim2.new(0, 100,0, 100), UDim2.new(0.895, 0,0.653, 0), Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, .5)
end)
script.Parent.Jump.MouseLeave:Connect(function()
	script.Parent.Jump:TweenSizeAndPosition(UDim2.new(0, 75,0, 75), UDim2.new(0.904, 0,0.669, 0), Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, .5)
end)

Any help is appreciated. Thanks!

In the documentation for TweenSizeAndPosition it states that the third argument should be the EasingDirection and the four argument should be the EasingStyle.

Your code but with the easing styles/directions in the correct order

script.Parent.Jump.MouseEnter:Connect(function()
	script.Parent.Jump:TweenSizeAndPosition(UDim2.new(0, 100,0, 100), UDim2.new(0.895, 0,0.653, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, .5)
end)
script.Parent.Jump.MouseLeave:Connect(function()
	script.Parent.Jump:TweenSizeAndPosition(UDim2.new(0, 75,0, 75), UDim2.new(0.904, 0,0.669, 0), Enum.EasingDirection.InOut,Enum.EasingStyle.Linear, .5)
end)
1 Like

Seems like you do not know too much about tweening , here is a helpful article.
Roblox TweenService Explanation
Oof, @Halalaluyafail3 beat me to it.

OK, thanks!

[30 characters lol]

OK, thanks for the help. Weird, I got that right, and then changed it haha

[30 characters]