Shunonni Craft

A site full of guides!

It all started in 2022.

Make sure to check out the articles!

Roblox scripting


This is the first part of the website about Roblox.

Move script:

===========================================================

— Tweens a part back and forth based on a chosen axis–

— The button has an on/off state which moves the part forwards or backwards–

local TweenService = game:GetService(“TweenService”)

local button = workspace.Base.part_here –put the name of the object here.–

— Customizable variables–

local TWEEN_TIME = 10

local TWEEN_MOVE_DISTANCE = 100

— Tween variables

local buttonTweenInfo = TweenInfo.new(

TWEEN_TIME, — Time

Enum.EasingStyle.Quad, — EasingStyle

Enum.EasingDirection.Out — EasingDirection

)

— Calculate new CFrame for button position

local offsetCFrame = CFrame.new(0, 0, TWEEN_MOVE_DISTANCE * -1)

local newCFrame = button.CFrame:ToWorldSpace(offsetCFrame)

— Create a tween and play it

local tweenButton = TweenService:Create(button, buttonTweenInfo, {CFrame = newCFrame})

tweenButton:Play()

–do not mess up the script. you may have to re-insert this.–

===========================================================

Back to home