This script is in a GuiObject and the text seems to appear and disappear randomly when moving my mouse over it rapidly. I only want the text to appear when it's either Tweened out or disappear when it's Tweening back in. Any edits I could make to my code to make it work properly?

local Redeem = script.Parent
local Enabled = false

Redeem.MouseEnter:connect(function()
	if not Enabled then
		Enabled = true
		Redeem:TweenSizeAndPosition(UDim2.new(0.6, 0, 0.6, 0), UDim2.new(-0.6, 0, 0.2, 0), "Out", "Bounce", 0.75, true, nil)
		wait(0.35)
		Redeem.Text = " REDEEM "
	end
end)

Redeem.MouseLeave:connect(function()
	if Enabled then
		wait(2)
		Redeem.Text = ""
		Redeem:TweenSizeAndPosition(UDim2.new(0.1, 0, 0.6, 0), UDim2.new(-0.1, 0, 0.2, 0), "Out", "Quad", 1, true, nil)
		wait(1)
		Enabled = false
	end
end)

2 comments

0

well you are setting the text to "" before it tweens out so that's probably the reason, try making the text change AFTER it has tweened the position out.

0

I thought about that, but it make look a bit weird. I guess I must sacrifice some things for others.