-- Complete UI Animation Script
-- Just copy and paste this into a script inside your button part

local button = script.Parent
button.Name = "TeleportButton" -- Make sure the button is named correctly

-- WHERE TO TELEPORT (change these numbers to where you want players to go)
local teleportX = 20 -- Change this number
local teleportY = 5  -- Change this number
local teleportZ = 20 -- Change this number

-- Animation settings (you can change these if you want)
local loadingTime = 2 -- How long the loading screen shows (in seconds)
local slideSpeed = 0.5 -- How fast the screen slides in/out

-- Script starts here - no need to change anything below this line!
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")

-- Create the loading UI and show animation
local function showLoadingAnimation(player)
	local playerGui = player:WaitForChild("PlayerGui")

	-- Create the UI elements
	local screenGui = Instance.new("ScreenGui")
	screenGui.Name = "LoadingScreen"
	screenGui.Parent = playerGui

	-- Create black background
	local blackBackground = Instance.new("Frame")
	blackBackground.Name = "BlackBackground"
	blackBackground.Size = UDim2.new(1, 0, 1, 0)
	blackBackground.Position = UDim2.new(0, 0, -1, 0) -- Start above screen
	blackBackground.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
	blackBackground.BorderSizePixel = 0
	blackBackground.Parent = screenGui

	-- Create loading text
	local loadingText = Instance.new("TextLabel")
	loadingText.Name = "LoadingText"
	loadingText.Size = UDim2.new(0, 300, 0, 100)
	loadingText.Position = UDim2.new(0.5, -150, 0.5, -50)
	loadingText.BackgroundTransparency = 1
	loadingText.Text = "Loading."
	loadingText.TextColor3 = Color3.fromRGB(255, 255, 255)
	loadingText.TextScaled = true
	loadingText.Font = Enum.Font.SourceSansBold
	loadingText.Parent = blackBackground

	-- Slide the black screen down
	local tweenInfo = TweenInfo.new(slideSpeed, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
	local goal = {Position = UDim2.new(0, 0, 0, 0)}
	local tween = TweenService:Create(blackBackground, tweenInfo, goal)
	tween:Play()

	-- Animate the bouncing dots
	local dotPhase = 1
	local animationActive = true

	local function animateDots()
		while animationActive do
			if dotPhase == 1 then
				loadingText.Text = "Loading."
				dotPhase = 2
			elseif dotPhase == 2 then
				loadingText.Text = "Loading.."
				dotPhase = 3
			else
				loadingText.Text = "Loading..."
				dotPhase = 1
			end
			wait(0.5)
		end
	end

	-- Start the dot animation
	spawn(animateDots)

	-- Wait for loading time
	wait(loadingTime)

	-- Stop animation
	animationActive = false

	-- Teleport the player
	local character = player.Character
	if character and character:FindFirstChild("HumanoidRootPart") then
		character.HumanoidRootPart.CFrame = CFrame.new(teleportX, teleportY, teleportZ)
	end

	-- Slide the screen away
	local tweenInfoOut = TweenInfo.new(slideSpeed, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
	local goalOut = {Position = UDim2.new(0, 0, 1, 0)} -- Move below screen
	local tweenOut = TweenService:Create(blackBackground, tweenInfoOut, goalOut)
	tweenOut:Play()

	-- Clean up when done
	tweenOut.Completed:Connect(function()
		screenGui:Destroy()
	end)
end

-- When button is clicked, show animation and teleport
button.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		showLoadingAnimation(player)
	end
end) ok this script ismaking it to were you can go over it so fix this please