TweenPosition Not Working

I have been scripting a ScreenGui for an awards ceremony at a group that I co-own, and three of my Tweens don’t seem to be working. I put the 3 lines that aren’t working in bold text. I’ve looked around the forum and on the Developer Hub, but I can’t seem to find any solutions.

function announcewinners(N1Rank, N1UserId, N2Rank, N2UserId, N3Rank, N3UserId, winner)
		N1.Image = game.Players:GetUserThumbnailAsync(N1UserId, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size420x420)
		N1.Username.Text = game.Players:GetNameFromUserIdAsync(N1UserId)
		N1.Rank.Text = N1Rank
		
		N2.Image = game.Players:GetUserThumbnailAsync(N2UserId, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size420x420)
		N2.Username.Text = game.Players:GetNameFromUserIdAsync(N2UserId)
		N2.Rank.Text = N2Rank
		
		N3.Image = game.Players:GetUserThumbnailAsync(N3UserId, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size420x420)
		N3.Username.Text = game.Players:GetNameFromUserIdAsync(N3UserId)
		N3.Rank.Text = N3Rank
		wait(1)
		N1:TweenPosition(UDim2.new(0, 0,0.35,0), 'Out', 'Quad', 2)
		wait(2)
		N2:TweenPosition(UDim2.new(0.35, 0,0.35,0), 'Out', 'Quad', 2)
		wait(2)
		N3:TweenPosition(UDim2.new(0.7, 0,0.35,0), 'Out', 'Quad', 2)
		wait(4)		
		N1:TweenPosition(UDim2.new(0, 0,0.15,0), 'Out', 'Quad', 2)		
		N2:TweenPosition(UDim2.new(0.35, 0,0.15,0), 'Out', 'Quad', 2)
		N3:TweenPosition(UDim2.new(0.7, 0,0.15,0), 'Out', 'Quad', 2)
		textthree:TweenPosition(UDim2.new(0, 0,-1,0), 'Out', 'Quad', 2)
		title.Position = UDim2.new(0,0,1,0)
		title.Text = "And the winner is..."
		title:TweenPosition(UDim2.new(0, 0,0.35,0), 'Out', 'Quad', 2)
		if winner == N1 then	
			**title:TweenPosition(UDim2.new(0,0,1,0), 'Out', 'Quad', 2)**
            **N2:TweenPosition(UDim2.new(0,0,1,0), 'Out', 'Quad', 2)**
            **N3:TweenPosition(UDim2.new(0,0,1,0), 'Out', 'Quad', 2)**
			wait(4)
			N1:TweenPosition(UDim2.new(0.35, 0,0.15,0), 'Out', 'Quad', 2)
			title.Text = game.Players:GetNameFromUserIdAsync(N1UserId).."! Congratulations!"
			title:TweenPosition(UDim2.new(0, 0,0.15,0), 'Out', 'Quad', 2)
		elseif winner == N2 then	
			
		elseif winner == N3 then
				
	end	
end

There are supposed to be 4 "end"s, there is only 2. That is your issue. Here is what my code looks like.

if 1 then
       if 0 then
              print("ok")
       end
end

Every time there is a “then”, there is an end added to it. You are missing 2 "end"s, and then that should fix the issue.
if not then I don’t know.

Not true.
He is using elseif which doesn’t require its own end.
You only need 1 end for each if which he only has 1 of.

2 Likes

Well then if that is true, then I do not have a solution for this yet.

The 5th parameter of TweenPosition is the override bool.
If you do this:

title:TweenPosition(UDim2.new(0,0,1,0), 'Out', 'Quad', 2, true)

It will override any currently playing tween. That would be why your tween isn’t playing.

Or in your case, you might have forgotten to put a wait before those if statements.

Most likely. In this case the if statements begin before the tweening is finished…

Thank you! I appreciate it. Didn’t know that there was a 5th parameter that did that.

1 Like