Help with GUI moving smoothly

Hello! I’ve been working on a map voting GUI for my game, and was working on an animation where the losing maps slide off the screen after the vote. However, despite the loop running with no wait in between, it still lags, and the animation doesn’t look smooth.

Essentially, I need to figure out why this code is running slow:

robloxapp-20220618-1603407_Trim.wmv (502.2 KB)

if frame.Option1.Button.OptionTitle.Text ~= game.ServerScriptService.GameLoop.Maps.CurrentMap.Value.Name then
			repeat
				frame.Option1.Position = frame.Option1.Position + UDim2.new(0, 0, 0.01, 0)
			until frame.Option1.Position.Y.Scale < 1.35	
		end

I couldn’t find any reason as to why it moves so slow. I’ve tried with and without a ‘wait’ line inside the repeat loop, and it still seems to move slow anyway. Any help would be appreciated, I really don’t know why this would happen.

Hey there something called tweens exist: this will help you.
https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition

1 Like

Thanks, this seems to work. I’ll have to learn how to make it work better, but it definitely makes it a lot smoother.