Pointing out some issues:
Let's begin with the call of the TweenSize method. This function belongs to the abstract GUIObject class, meaning it's only invokable from an Instance of said class; you're halfway there, though, you've attempted to derive it from a property.
The method alone requires a total of six arguments, with one mandatory: the UDim2 final—which we can construct in-line.
Let's see how this would've looked:
Icon:TweenSize(UDim2.new(0, 0, 0, 0))
Addressing the problem:
The TweenSize method of GUIObject is designed to do just that, "tween" it's size. Though, from the looks of it, you appear to be trying to smoothly adjust a property. To achieve this, we have to take a different approach with TweenService.
To construct a specialized Tween designed to adjust a property, we have to build a customized tween-object with the Create function.
This function requires three mandatory arguments, that of which are:
TweenService:Create(
The object we're tweening,
The details of said tween,
The properties to adjust
)
To provide the tween details, we use a TweenInfo Object; click the hyperlink to learn which details are assignable, and what each argument represents.
Bringing it all together:
local TweenService = game:GetService("TweenService")
local TweenDetails = TweenInfo.new(1)
local Icon = script.Parent
local TweenEnter = TweenService:Create(Icon, TweenDetails, {SliceScale = 0.25})
local TweenLeave = TweenService:Create(Icon, TweenDetails, {SliceScale = 0.1})
Icon.MouseEnter:Connect(function()
TweenEnter:Play()
end)
Icon.MouseLeave:Connect(function()
TweenLeave:Play()
end)
2 comments
This is probably the best answer you could have given! I understand that TweenSize uses UDim2, but I thought you could just use it without it for instances like this. I also thought about using TweenService, but I didn't know how, and this mini-tutorial helped a lot! Again, thank you!
Glad I could help!