RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"a button that moves around map using tweens and changes size and moves when clicked"
-- local script (StarterGui) local player = game.Players.LocalPlayer local screenGui = Instance.new("ScreenGui", player.PlayerGui) local button = Instance.new("TextButton", screenGui) button.Text = "Move" button.TextColor3 = Color3.fromRGB(255, 255, 255) button.BackgroundColor3 = Color3.fromRGB(0, 0, 0) button.Position = UDim2.new(0.5, 0, 0.5, 0) button.Size = UDim2.new(0, 100, 0, 50) button.AnchorPoint = Vector2.new(0.5, 0.5) button.BorderSizePixel = 0 local tweenService = game:GetService("TweenService") local function moveButton() local newX = math.random(0, game.Workspace.Map.Size.X) local newY = math.random(0, game.Workspace.Map.Size.Y) local newSize = math.random(25, 100) local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local positionTween = tweenService:Create(button, tweenInfo, {Position = UDim2.new(0, newX, 0, newY)}) local sizeTween = tweenService:Create(button, tweenInfo, {Size = UDim2.new(0, newSize, 0, newSize)}) positionTween:Play() sizeTween:Play() end button.MouseButton1Click:Connect(moveButton)