My hover to button code is buggy

hello, im doing a gui thing where if you hover it it will enlarge then when the mouse is no longer in the gui its going to go back to its original size but there is a bug for some reason

as you can see if i just moved my mouse quikly it kind off get confused

local play = script.Parent.play
local sett = script.Parent.Settings

local twn = game:GetService("TweenService")

play.MouseEnter:Connect(function()
	play:TweenSize(UDim2.new(0.242, 0, 0.139, 0))
end)

play.MouseLeave:Connect(function()
	play:TweenSize(UDim2.new(0.167, 0, 0.072, 0))
end)

here is the code now so yeah its pretty basic but why is it doing that??? is there anyone that knows what is happening?!

1 Like

:TweenSize() has a boolean for overriding any playing tweens, use that.

local play = script.Parent.play
local sett = script.Parent.Settings

local twn = game:GetService("TweenService")

play.MouseEnter:Connect(function()
	play:TweenSize(UDim2.new(0.242, 0, 0.139, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.05, true)
end)

play.MouseLeave:Connect(function()
	play:TweenSize(UDim2.new(0.167, 0, 0.072, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.05, true)
end)
1 Like

I will try tommorow but i dindt actually read about the tween size or posisition blah nlah i just went in to code it so sorry if im kind off dumb :sweat_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.