So basically I have this code inside a function, and everytime it’s called. It’s supposed to start tweening the size if my ‘TextLabel’
Once the tween finishes, it starts another tween that scales the size back to it’s original size and also will fade the TextTransparency to 1 (transparent)
But this 2nd tween will cancel if the function is called again and reset the TextTransparency to 0 (non-transparent)
But the 2nd tween doesn’t seem too cancel and the text still fades away everytime? What am I doing wrong here?
Im struggling a bit to understand what you are saying, apologies my reading comprehension is not the best. However, from what I can understand I’d recommend using a wait event like this:
local killScore = game.Players.LocalPlayer.PlayerGui:WaitForChild("KillstreakGUI"):WaitForChild("KillScore")
killScore.TextTransparency = 0
local newTween = game:GetService("TweenService"):Create(killScore, TweenInfo1, {Size = UDim2.new(0, 303, 0, 92)})
local returnTween = game:GetService("TweenService"):Create(killScore, TweenInfo2, {Size = originalSize, TextTransparency = 1})
--removed the returntween:cancel() because it isn't necessary
newTween:Play()
newTween.Completed:Wait()
returnTween:Play()
This way you dont have to make a whole new function just to play the returnTween
Assuming newtween is a 3 second tween the return tween will wait 3 seconds before playing.
Another solution could be to make sure the originalsize variable is correct
Ok. I have a TextLabel that is used to show +points
Like for example I kill a Zombie and a +50 pops up on my screen.
I use a tween call it Tween#1)
Tween#1 tweens the size of the TextLabel to a larger size. And then when that tween finishes, I run another tween called Tween#2. Tween#2 then both scales the size back down to the original size and also tweens the TextTransparency to 1 (invisible)
Think of it as a fade in and out with the size growing larger and then smaller.
Everytime the function is called, I want to restart Tween#1 and set the transparency back to 0 (visible) but the problem I’m having is even though I cancel tween#2, it still appears to keep running the transparency tween, and the text fades out before finally resetting the transparency once tween#2 finishes.