Zanance
(Zan)
November 16, 2022, 12:44pm
1
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
1 Like
3devide0
(3devide0)
November 16, 2022, 1:18pm
2
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
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