You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Make a button big when player holds the button down using mousebutton1down and tween it back to its original size when they release using mousebutton1up
What is the issue? Include screenshots / videos if possible!
Problem is that when i click it really fast it stays big
What this is doing here, theres is a collectionservice group of buttons that are doing this tween. I’m looping through them and making the event trigger for them
local thread = nil
local big = false
local rate = 1.5
for i, btnframe in pairs(BUTTONSIZINGGROUP) do
if btnframe:IsA("TextButton") and btnframe.Parent.Name == "Front" then
btnframe.MouseButton1Down:Connect(function()
thread = nil
wait(0.1)
thread = coroutine.create(function()
if big == false then
btnframe.Parent.Parent:TweenSize(UDim2.new(btnframe.Parent.Parent.Size.X.Scale*rate, 0, btnframe.Parent.Parent.Size.Y.Scale*rate, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.3)
big = true
end
end)
coroutine.resume(thread)
end)
btnframe.MouseButton1Up:Connect(function()
print("up")
if thread ~= nil then
coroutine.close(thread)
thread = nil
if big == true then
big = false
btnframe.Parent.Parent:TweenSize(UDim2.new(btnframe.Parent.Parent.Size.X.Scale/rate, 0, btnframe.Parent.Parent.Size.Y.Scale/rate, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.3)
end
end
end)
end
end
first of all do this:
I would make you the modified script but it would take me a long time what you could do is:
make a variable which says true local debounce = true
then when the player presses the button it will be set to false debounce = false
then do a elseif not debounce then you will execute the code but making the button smaller or something like that more or less
Try adding a debounce that only executes the code if it’s false. And when you click it and it gets bigger it sets to true and when it gets smaller it sets to false.