How can I check if Gui Tween is finish?

Hello Everyone,

I want check if a tween is complete finish but how can I do that?

this is what I have been created untill now:

Edited: Again I just dont want let the player spam the tween so many times as he wants. Only when the tween is finish he can play it again

	local tween = TweenService:Create(GreenCircle, TweenInfo.new(1), {ImageTransparency = GreenCircle.ImageTransparency + 1})
		if tween.IsComplete then
			tween:Play()
		end

But it doesnt seem work :frowning:

1 Like

This is the solution:
Tween.Completed:Wait()

1 Like

I saw that one but this doesnt seem help me

I want make a if statement,

like:

if tween.complete then

end

Thats because I have actually a input tween and I dont want reset the tween everytime new:

uis.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Q then
		randomPicture.Visible = false		
		GreenCircle.Visible = true
		GreenCircle.ImageTransparency = 0.15
		GreenCircle.Size = UDim2.new(0,0,0,0)
		GreenCircle.ImageTransparency = 0.15
		GreenCircle.Size = UDim2.new(0,0,0,0)
		GreenCircle.Position = UDim2.new(0.5,0,0.5,0)
		GreenCircle:TweenSizeAndPosition(UDim2.new(0, 150,0, 150), UDim2.new(-0.19, 0,-0.17, 0))
		local tween = TweenService:Create(GreenCircle, TweenInfo.new(1), {ImageTransparency = GreenCircle.ImageTransparency + 1})
	end
end)

Theres a Connect function for that

Example:

Tween.Completed:Connect(function(playBackState)
   --Logic here!
end
function TweenCreate(Obj,Info,Props)
    local T = game:GetService("TweenService"):Create(Obj,Info,Props)
    T:Play()
    return T
end
local Tween = TweenCreate(GreenCircle, TweenInfo.new(1), {ImageTransparency = GreenCircle.ImageTransparency + 1})
Tween.Completed:Wait()

This doesnt seem work. You can try it with my script

And as I said I want make a if statement

From what I can see in the code, you didn’t tried to Play it. So the Completed doesn’t run at all

Okey then let me try to put your in my script

1 Like

omg roblox studio crashed. I dont know it got an overflow

Omg I hope everything doesnt get delete because I didnt save my file

I can see in the code that it will Loop because of +1 in it

Edit: I think its not. Maybe something else messes your Studio.

AHHHHH I AM SO ANGRY,

It was not your fault. You just wanted help me. Now my full script got deleted and I need to script everything new

This was the first time that happen to me

Ohh I found my script in roblox auto save. Not the best but still everything what I have been scripted 20minits ago

uis.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Q then
		randomPicture.Visible = false		
		GreenCircle.Visible = true
		GreenCircle.ImageTransparency = 0.15
		GreenCircle.Size = UDim2.new(0,0,0,0)
		GreenCircle.ImageTransparency = 0.15
		GreenCircle.Size = UDim2.new(0,0,0,0)
		GreenCircle.Position = UDim2.new(0.5,0,0.5,0)
		GreenCircle:TweenSizeAndPosition(UDim2.new(0, 150,0, 150), UDim2.new(-0.19, 0,-0.17, 0))
		local tween = TweenService:Create(GreenCircle, TweenInfo.new(1), {ImageTransparency = GreenCircle.ImageTransparency + 1})	
		tween:Play()
		tween.Completed:Connect(function(playBackState)
			tween:Play()
		end)
	end
end)

So this was the script that broke my roblox

Oh, So you want to loop it?

If so… you don’t need a Completed at all.

You just need to Modify the TweenInfo

Just like this:

TweenInfo.new(
1, -- Interval
Enum.EasingStyle.Sine, -- The effect of Tweening Animation
Enum.EasingDirection.Out, -- The Direction (I can't actually explain the meaing of this but I use Out most of the time)
0, -- How many times does the tween will play. -1 will loop the infinitely
false, -- Does the tween will play in reverse?
0 -- Delay
)

I just want let the player click so many times as he wants, but the tween should play just once.