For Some reason whenever I spam click this button it can sometimes stop running the mouse enter tween and reset to its normal size instead of the enlarged size of the mouse enter and I don’t know why.
local ts = game:GetService("TweenService")
local playerGui = game.Players.LocalPlayer.PlayerGui
local clickSound
local hoverSound
local hoverTweenInfo = TweenInfo.new(.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
local unHoverTweenInfo = TweenInfo.new(.15, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tweenInfo = TweenInfo.new(.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut, 0, true)
local button = script.Parent
button.MouseEnter:Connect(function()
local hoverTween = ts:Create(button, hoverTweenInfo, {Size = UDim2.new(0.175, 0,0.45, 0)})
hoverTween:Play()
end)
button.MouseLeave:Connect(function()
local unHoverTween = ts:Create(button, unHoverTweenInfo, {Size = UDim2.new(0.164, 0,0.412, 0)})
unHoverTween:Play()
end)
button.MouseButton1Click:Connect(function()
local clickTween = ts:Create(button, tweenInfo, {Size = UDim2.new(0.164, 0,0.412, 0)})
clickTween:Play()
end)
local playerGui = game.Players.LocalPlayer.PlayerGui
local clickSound
local hoverSound
local button = script.Parent
button.MouseEnter:Connect(function()
button:TweenSize(UDim2.new(0.175, 0,0.45, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Back, .3, true)
end)
button.MouseLeave:Connect(function()
button:TweenSize(UDim2.new(0.164, 0,0.412, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .15, true)
end)
button.MouseButton1Click:Connect(function()
button:TweenSize(UDim2.new(0.164, 0,0.412, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .25, true)
end)
use this script, it uses tweensize instead of tweenservice because it has a property you can modify that can override in progress tween and doesnt break at all