- What do you want to achieve? Keep it simple and clear!
Hello, so basically I’m making a script that tweens the size and position of a Crafting UI when you click on a button.
- What is the issue? Include screenshots / videos if possible!
the Crafting UI tweens to its UDim that I wanted. But the problem is that when I kept clicking onto the button the v2 also know as bool/debounce couldn’t stop players from clicking it before tweening back. Resulting it to overrun the tween (Haven’t finish playing the tween) and making the Crafting UI not visible.
local storebutton = script.Parent.storeframe:WaitForChild("storebutton")
local v2 = true
local function storebuttononclick()
storebutton:TweenPosition(UDim2.new(-0.014, 0,0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .1, false)
if script.Parent.ImageLabel.Visible == false and v2 then
v2 = false;
script.Parent.ImageLabel.Visible = true
OpenCraftingUI()
Click()
storebutton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
v2 = true
elseif v2 then
v2 = false
storebutton.BackgroundColor3 = Color3.fromRGB(0, 166, 249)
Error()
CloseCraftingUI()
delay(1, function()
storebutton:TweenPosition(UDim2.new(-0.014, 0,-0.134, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .1, false)
script.Parent.ImageLabel.Visible = false
v2 = true
end)
end
end