How do I make a button move

Hi currently created 747 interactive cockpit and, how do, I make buttons move to the left when I click on them.You can check the game, in my profile.

1 Like

Hello.
Scripting support is not for asking for code.

To answer your question - you need to use UDim2 positions.

2 Likes

:watermelon: Hiya!

This is what we have to do step by step:

First off, we need to create a local script inside of our screen GUI! The script will have a print() statement which we can remove.

Then we’ll have to check if our button is being clicked.

local button = --Locate the button to the script here!

button.MouseButton1Click:Connect(function()

end)

Remember to add where the button is located. Moving on, we get to our variables and the actual which should look like this.

local Button = --Locate the button to the script here!

Button.MouseButton1Click:Connect(function()
local TweenService = game:GetService("TweenService")

local TimeToWait = 0 --Replace 0 with the amount the script of time the script will take to tween!
local EasyingStyle = Linear --Replace this with the type of tween you would like!
local TweenPosition = 0 --Add UDim2 position coordinates here!

local TweenInfo = TweenInfo.new(TimeToWait,Enum.EasingStyle.EasingStyle)
local TweenData = {}
TweenData.Position = UDim2.new(TweenPosition)
local Tween = TweenService:Create(Button,TweenInfo,TweenData)
Tween:Play()
end)

Hope this helped!

1 Like