Is there a way to Tween a Parts size by hovering on it?

So I’m trying to tween a parts size when it’s being hovered over it with a mouse. I wrote the following code but doesn’t seem to work and theres no errors.

local TweenService = game:GetService("TweenService")

local HoverPart = script.Parent

local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false)

HoverPart.MouserEnter:Connect(function()
	TweenService:Create(HoverPart, tweenInfo, { Size = 5, 2, 3 }):Play()
end)

HoverPart.MouseLeave:Connect(function()
	TweenService:Create(HoverPart, tweenInfo, { Size = 4, 1, 2 }):Play()
end)

Any feedback is appreciated :smile:

1 Like

i think that

MouserEnter

work with gui so use clickdetector and put that code inside it

local TweenService = game:GetService("TweenService")

local clickDetector = script.Parent

local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false)

clickDetector.MouseHoverEnter:Connect(function()
	TweenService:Create(HoverPart, tweenInfo, { Size = 5, 2, 3 }):Play()
end)

clickDetector.MouseHoverLeave:Connect(function()
	TweenService:Create(HoverPart, tweenInfo, { Size = 4, 1, 2 }):Play()
end)

i hope it work :slight_smile:

1 Like

Just use a click detector way easier than using :GetService

You are doing it all right but u need to change the hover detection to the click detector