DelnRDev
(DelnRDev)
February 29, 2020, 10:25am
#1
my GUI have a delay if you keep clicking it how do i fix it
here is the script
local open = script.Parent.Parent.Parent.Open
local buttonFrame = script.Parent.Parent.Parent
local text = script.Parent.Parent.TextLabel
script.Parent.MouseButton1Click:Connect(function()
if open.Value == false then
open.Value = true
buttonFrame:TweenSize(UDim2.new(0.23, 0,0.109, 0))
text.TextColor3 = Color3.new(0, 0, 0)
else
open.Value = false
buttonFrame:TweenSize(UDim2.new(0.21, 0,0.089, 0))
text.TextColor3 = Color3.new(227, 210, 18)
end
end)
slothfulGuy
(slothfulGuy)
February 29, 2020, 10:28am
#2
You need to add a second cooldown to wait for the Tweening process to finish. If you spam the button, it’s like you’re telling it to tween your GUIs, while the previous Tween process haven’t finished so the process overlaps (many tweenings process at once, giving illusion that it delays).
DelnRDev
(DelnRDev)
February 29, 2020, 10:30am
#3
but i have another position tween can keep spamming it
slothfulGuy
(slothfulGuy)
February 29, 2020, 10:33am
#4
What do you mean? What I’m trying to say is to make a cooldown for every time the button is pressed, like 5 seconds wait or something so the previous tweening process can finish first and not overlap.
Alternatively, you can add a part of the script that checks if a GUI is still tweening, so the player’s click doesn’t make it tween twice.
MarkiPr0
(Marki)
February 29, 2020, 10:40am
#5
you might wanna edit the tween a little and also make sure another tween can override this one
by just adding true
for example:
buttonFrame:TweenSize(UDim2.new(0.23, 0,0.109, 0), true)
apply this to both tweens and you’ll be good to go
1 Like
DelnRDev
(DelnRDev)
February 29, 2020, 10:44am
#6
i tried this but
[ Unable to cast bool to token]
slothfulGuy
(slothfulGuy)
February 29, 2020, 10:52am
#7
In that case, not the correct place for parameter.
It should be like this:
buttonFrame:TweenSize(UDim2.new(0.23, 0,0.109, 0), 2, true)
Note: Replace the 2 with what you want, it means 2 seconds (which is how long you want the Tween to be).
DelnRDev
(DelnRDev)
February 29, 2020, 10:59am
#8
still
[Unable to cast bool to token]
i think that can only use in position tween
MarkiPr0
(Marki)
February 29, 2020, 11:00am
#9
you must put EasingStyle and EasingDirection before that, like I said, edit your tween
for example:
buttonFrame:TweenSize(UDim2.new(0.23, 0,0.109, 0) Enum.EasingDirection.In,Enum.EasingStyle.Linear, 2 ,true)
instead of 2
you can put however you want your team to last
JoolCaat
(JoolCaat)
February 29, 2020, 11:04am
#10
Don’t tweens stop if another tween begins on the same property?
DelnRDev
(DelnRDev)
February 29, 2020, 11:08am
#11
did u type anything wrong with the enum cuz there is a error on enum
MarkiPr0
(Marki)
February 29, 2020, 11:09am
#12
I did, oopsie
fixed line:
buttonFrame:TweenSize(UDim2.new(0.23, 0,0.109, 0), Enum.EasingDirection.In,Enum.EasingStyle.Linear, 2 ,true)
3 Likes
DelnRDev
(DelnRDev)
February 29, 2020, 11:12am
#13
OMG, thx thats what i want and i learnt new stuff <3
1 Like