RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"a advanced main menu with tweens"
-- This mode only specializes in GUI scripts, please use another appropriate mode for getting better responses for this query -- Example code for an advanced main menu with tweens in Roblox GUI local TweenService = game:GetService("TweenService") local player = game.Players.LocalPlayer local screenGui = Instance.new("ScreenGui", player.PlayerGui) local background = Instance.new("Frame", screenGui) background.BackgroundColor3 = Color3.fromRGB(0, 0, 0) background.Size = UDim2.new(1, 0, 1, 0) local logo = Instance.new("ImageLabel", background) logo.Image = "rbxassetid://123456789" -- Replace with your own logo asset ID logo.Size = UDim2.new(0.5, 0, 0.5, 0) logo.Position = UDim2.new(0.25, 0, 0.1, 0) local playButton = Instance.new("TextButton", background) playButton.Text = "Play" playButton.TextColor3 = Color3.fromRGB(255, 255, 255) playButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) playButton.Position = UDim2.new(0.25, 0, 0.6, 0) playButton.Size = UDim2.new(0.2, 0, 0.1, 0) playButton.UICorner = 5 local optionsButton = Instance.new("TextButton", background) optionsButton.Text = "Options" optionsButton.TextColor3 = Color3.fromRGB(255, 255, 255) optionsButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) optionsButton.Position = UDim2.new(0.5, 0, 0.6, 0) optionsButton.Size = UDim2.new(0.2, 0, 0.1, 0) optionsButton.UICorner = 5 local quitButton = Instance.new("TextButton", background) quitButton.Text = "Quit" quitButton.TextColor3 = Color3.fromRGB(255, 255, 255) quitButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) quitButton.Position = UDim2.new(0.75, 0, 0.6, 0) quitButton.Size = UDim2.new(0.2, 0, 0.1, 0) quitButton.UICorner = 5 -- Tween the logo and buttons when the menu opens local logoTween = TweenService:Create(logo, TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {Position = UDim2.new(0.25, 0, 0.25, 0)}) local playButtonTween = TweenService:Create(playButton, TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {Position = UDim2.new(0.25, 0, 0.75, 0)}) local optionsButtonTween = TweenService:Create(optionsButton, TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {Position = UDim2.new(0.5, 0, 0.75, 0)}) local quitButtonTween = TweenService:Create(quitButton, TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {Position = UDim2.new(0.75, 0, 0.75, 0)}) -- Open the menu and start the tweens local function openMenu() screenGui.Enabled = true logoTween:Play() playButtonTween:Play() optionsButtonTween:Play() quitButtonTween:Play() end -- Close the menu and reset the positions local function closeMenu() screenGui.Enabled = false logo.Position = UDim2.new(0.25, 0, 0.1, 0) playButton.Position = UDim2.new(0.25, 0, 0.6, 0) optionsButton.Position = UDim2.new(0.5, 0, 0.6, 0) quitButton.Position = UDim2.new(0.75, 0, 0.6, 0) end -- Connect the buttons to their respective functions playButton.MouseButton1Click:Connect(function() -- Add your play button code here end) optionsButton.MouseButton1Click:Connect(function() -- Add your options button code here end) quitButton.MouseButton1Click:Connect(function() -- Add your quit button code here end)