How to make parts move?

Greeting everyone! I have a question to ask.
I’m very new to scripting, and I really need to find out how to script so I can be advanced and make the games that I need to make. If you have suggestions on where to start scripting and where I can learn
Also, please do not suggest outdated channels, or channels that doesn’t explain the script, they just type it and call out the words and put the whole script in the description of theirs video.

But anyway, to the main question. How can I make these 3 lasers move up and down?

lasers

9 Likes

https://www.youtube.com/watch?v=qgGDwTn0zgo maybe this can help you :slightly_smiling_face:

7 Likes

Hey! When I started out learning Roblox and what it could offer, I found CFrames to be a rather difficult concept to grasp when not exposed to a similar concept. Here are some resources that helped me understand what CFrames are and how it works.

For this particular case, you could use TweenService or CFrame:Lerp.

Here’s an example for you using TweenService:

local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(
    2, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)
-- More can be found here: https://developer.roblox.com/en-us/api-reference/function/TweenService/Create

local Part = -- Part that you want to animate

local goal = {} -- Contains all properties that you want your tween to change
goal.Position = Vector3.new(x,y,z) -- x (left, right), y (up, down), z (forwards, backwards)  -- A property (can also use CFrames but, I don't think you wanted rotation)

local Tween = TweenService:Create(Part, TweenInfo, goal) -- creates a tween with 'part' using TweenInfo that reaches 'goal.Position'
Tween:Play() -- Plays tween you created above

Hope this helps!

17 Likes

Are there any tutorials for beginners also?

2 Likes

you can use this for make moving parts:



3 Likes

Roblox has made a series of tutorials to help beginners get a grasp of their engine. https://www.youtube.com/playlist?list=PLuEQ5BB-Z1PJ4JIDXpttxuvCzJMeIqzMi

In addition, I recommend taking a look at: Platform Overview | Documentation - Roblox Creator Hub

2 Likes

Hey there.
I would suggest using :TranslateBy() or CFrame:Lerp() for this type of thing.
Since you are a new scripter, I would suggest learning about CFrames (or vector3s) before trying to attempt this. Read about it on the ROBLOX Wiki.

2 Likes

Can you hand me the link to the roblox wiki scripting part please? :slight_smile:

1 Like

Sorry, there’s not really a scripting part per se, but there is info on how it’s used (i.e you have a cframe to lerp to and an alpha).

2 Likes

Hi! you could use CFrame CFrame | Documentation - Roblox Creator Hub or you can also use TweenService TweenService | Documentation - Roblox Creator Hub , both are very easy to use and very useful.

4 Likes