Below is the SAME script you’re using, but with the dots laid out like this:
code
Loading ← text (centered)
. . . ← three dots
left center right
• The center dot is exactly under “Loading”.
• The left & right dots are spaced ±24 pixels from that center.
• During the wave we only move the dots up/down, not sideways, so the alignment never drifts.
Copy-paste the whole thing into a fresh Script inside your button, then test.
(If you still want a slightly different spacing just change the dotXOffsets table.)
lua
-------------------------------------------------------------
-- CLICK-ONLY BUTTON + CENTERED LOADING UI + WAVE DOTS --
-- Put this Script INSIDE your button part --
-------------------------------------------------------------
local button = script.Parent -- the part this script is inside
local teleportTargetName = "Room2Spawn" -- CHANGE to the name of the destination part
local loadingTime = 2 -- seconds the loading screen stays up
local slideSpeed = 0.4 -- speed of slide-in / out
local dotsAmplitude = 8 -- how many pixels the dots bounce
local isBusy = false -- block double-clicks
local TweenService = game:GetService("TweenService")
----------------------------------------------------------------
-- UI CREATION
----------------------------------------------------------------
local function createLoadingGui(player: Player)
local pg = player:WaitForChild("PlayerGui")
local gui = Instance.new("ScreenGui")
gui.IgnoreGuiInset = true
gui.ResetOnSpawn = false
gui.Name = "LoadingScreen"
gui.Parent = pg
-- black background (start above)
local black = Instance.new("Frame")
black.Size = UDim2.new(1,0,1,0)
black.Position = UDim2.new(0,0,-1,0)
black.BackgroundColor3 = Color3.new(0,0,0)
black.BorderSizePixel = 0
black.Parent = gui
-- container centred on screen
local container = Instance.new("Frame")
container.Size = UDim2.new(0,300,0,120)
container.Position = UDim2.new(0.5,-150,0.5,-60)
container.BackgroundTransparency = 1
container.Parent = black
-- "Loading" text
local label = Instance.new("TextLabel")
label.Size = UDim2.new(1,0,0.6,0) -- 60 % height
label.Position = UDim2.new(0,0,0,0)
label.Text = "Loading"
label.TextScaled = true
label.BackgroundTransparency = 1
label.Font = Enum.Font.SourceSansBold
label.TextColor3 = Color3.new(1,1,1)
label.Parent = container
----------------------------------------------------------------
-- three perfectly centred dots
----------------------------------------------------------------
local dots = {} -- stores dot TextLabels
local dotXOffsets = { -24, 0, 24 } -- left, centre, right (pixels)
-- change these 3 values if you want wider / narrower spacing
for i = 1, 3 do
local dot = Instance.new("TextLabel")
dot.Size = UDim2.new(0,20,0,24) -- fixed size
dot.Position = UDim2.new(0.5, dotXOffsets[i] - 10, 0.7, 0)
-- 0.5 scale anchors us to screen-centre, -10 compensates for dot width (20) so it’s centred
dot.Text = "."
dot.TextSize = 24
dot.TextScaled = false
dot.BackgroundTransparency = 1
dot.Font = Enum.Font.SourceSansBold
dot.TextColor3 = Color3.new(1,1,1)
dot.Parent = container
dots[i] = dot
end
return gui, black, dots, dotXOffsets
end
----------------------------------------------------------------
-- DOT WAVE (only Y moves, X stays fixed)
----------------------------------------------------------------
local function startDotWave(dots, xOffsets, stopSignal)
coroutine.wrap(function()
local t = 0
while not stopSignal.Value do
t += 0.1
for i, dot in ipairs(dots) do
local yOff = math.sin(t*math.pi*2 + (i-1)*math.pi/3) * dotsAmplitude
dot.Position = UDim2.new(0.5, xOffsets[i] - 10, 0.7, yOff)
end
task.wait(0.05)
end
end)()
end
----------------------------------------------------------------
-- MAIN SEQUENCE
----------------------------------------------------------------
local function playSequence(player: Player)
------------------------------------------------------------
-- 1. Build UI
------------------------------------------------------------
local gui, black, dots, xOffsets = createLoadingGui(player)
TweenService:Create(
black,
TweenInfo.new(slideSpeed, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{Position = UDim2.new(0,0,0,0)}
):Play()
------------------------------------------------------------
-- 2. Start wave
------------------------------------------------------------
local stopFlag = Instance.new("BoolValue")
startDotWave(dots, xOffsets, stopFlag)
------------------------------------------------------------
-- 3. Wait then teleport
------------------------------------------------------------
task.wait(loadingTime)
stopFlag.Value = true
local dest = workspace:FindFirstChild(teleportTargetName)
if dest and dest:IsA("BasePart") then
local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
if root then root.CFrame = dest.CFrame + Vector3.new(0,3,0) end
else
warn("Destination part '"..teleportTargetName.."' not found!")
end
------------------------------------------------------------
-- 4. Slide out & clean
------------------------------------------------------------
local tweenOut = TweenService:Create(
black,
TweenInfo.new(slideSpeed, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{Position = UDim2.new(0,0,1,0)}
)
tweenOut:Play()
tweenOut.Completed:Wait()
gui:Destroy()
isBusy = false
end
----------------------------------------------------------------
-- CLICK DETECTOR (click-only)
----------------------------------------------------------------
local detector = Instance.new("ClickDetector")
detector.MaxActivationDistance = 10
detector.Parent = button
detector.MouseClick:Connect(function(player)
if not isBusy then
isBusy = true
playSequence(player)
end
end)
The only edits are:
An xOffsets table ({-24, 0, 24}) so the center dot sits exactly under “Loading”, the others 24 px left & right.
Dot creation & animation now use UDim2.new(0.5, xOffsets[i] - 10, 0.7, …)
(-10 offsets each dot’s width/2 so its centre matches the X-offset).
Feel free to tweak the three numbers in dotXOffsets if you’d like the dots closer or farther apart.