What do i need to make a part move?

Greetings, thanks for trying to help me.
I really want to inprovemy programming skills, but every time i asssk something here im getting more and more confused.
Like said in the title, i would like to make a part move, and when it encounters an obstacle, it turns, and continue.
I don’t want to learn Lua but Scripting in general, but everytime i watch a video im or:

  • Getting more confused to what is going on.
  • Don’t know where to start (and most of the time it start nowhere)
  • Trying but don’t know what to write in the script.

I will ask you to not give me the link for the devforum starting, i already went in this link like thousands of times and every time i get out motivated but fall instantly when i don’t know what to write in the script…

Like said, i don’t want Lua but scripting in general, and i don’t want to be rude or something but it’s really hard to get help, everytime like said, i fall and get motivated, and fall and get motivated but fall again;;;…
It’s funny because everyone say that now with internet it’s easier to be up to something, but when we think about it it has never been so hard to improve in something…?!

4 Likes

Lua is Roblox’s programming language, and is the only thing you should be learning right now unless you are trying to program OUTSIDE of Roblox.

I recommend checking out Peaspod’s videos to get the basics covered.

1 Like

Well, there is not so much we can do to get you started but give you links and get you on the right path. For your question though, You mentioned that you want it to avoid obstacles, The only easy solution i can think of is pathfinding, Learn more about it here. https://developer.roblox.com/articles/Pathfinding

PeasFactory is not really a good source to learn from since most of the stuff are outdated.
a good source would be the official Lua reference which can be found here. https://www.lua.org/
^^ good to get you started but to learn about specific functions and what not i recommend checking out the roblox dev wiki https://developer.roblox.com

2 Likes

I would assume most of the basic videos are still credible, since they are just teaching the basic functions of Lua. I would still check them out, as they are easier to understand and pay attention to than just reading.

1 Like

Im just gonna give up and try javascript, thanks everyone for trying to help me, but i can’t do this…?!

1 Like

I definitely think you should give Lua your best shot, especially with Roblox. It can be very visually based, making it easy to understand. You can definitely do it, you just need to do it.

Watch a lot of videos, all the way to the end. Take notes, try what they are doing in the videos. Pretty soon you will get a good understanding of the basics, and you will be able to make your own simple games.

If you ever want to do more complicated stuff, like @ObscureBrandon mentioned, the Wiki is the place to find pretty much anything you need. And of course, the forum is here to help you.

You got it.

1 Like

I recommend you to watch some of AlvinBlox’s videos that covers basic things like variables and functions.
Also, try to learn one scripting language at a time. Familiarize yourself with Lua first then try to learn other scripting languages

2 Likes

He pretty much give a copy/pasta than make me learn something ?..!

2 Likes

Well, I dunno if this will help that much, but when I want to script something that either I haven’t scripted before or is really compilcated, I’ll spilt the script’s logic into parts i can understand, so that It’s much easier to comprehend and script faster.

It took me way too long to learn lua, but it wasn’t because lua is extremely hard (it isnt, it’s actually probably the easier languages out there), it was because I wasn’t actually trying to learn new things.

I didn’t try doing things like 2d arrays and server scripts, because I couldn’t understand the wiki and hence was extremely hard to learn it. It was only when I started to understand the wiki, I also started going to it whenever I wanted to learn something that could help me on a script im making. I also used google & scriptinghelpers to debug my scripts whenever there was an error I was stuck on.

What I’m trying to say here, is that once you understand how to debug/troubleshoot and understand the wiki/api/docs, you will already be half way there on learning how to script. If it’s the scripting words
/ jargon that confuses you, I recommend This Article.

2 Likes

To answer you question about moving parts you could use pathfinding or TweenService. Using loops isn’t advised as it causes a lot of lag and the movement doesn’t look realistic.

With scripting, learning JavaScript is just as difficult as leaning Lua. If you plan on making games on roblox I would advise you lean Lua as that is the language Roblox uses. Also learning Lua may be a little bit easier for you as you can ask people on here any quires and questions you may have.

I know how it feels when you are first stating out with scripting, you just feel like giving up as it feels like you are getting nowhere. I am going to be completely honest with you, it took me at least a week to figure out what script.Parent did. Everyone was in your position one day even the best programmers on here so don’t think you are the only one in this position.

Learning to script is just like learning to ride a bike. When you first start to learn to ride a bike you keep falling over and then eventually you can ride a bike without falling over. Scripting is just the same, you keep failing and then eventually you figure out how to script something. The best way to learn anything is by making mistakes and then learning from them mistakes. I have said this before and I am going to say it again, the hardest part about anything is learning how to start. This is the same with scripting, the hardest part is learning how to do the basics and then once you know how to do the basics the rest is a lot easier to learn.

3 Likes

I know lua can seem very daunting at times, or seem like its WAYY too complicated to understand/get into, but you must understand that there is a learning curve. Lua is actually quite easy to get into if you approach it the right way.

I think some of the most helpful things you can do right now are:

  • learn the basics (.Touched events, functions, properties)
  • start experimenting! One of the best ways to grow in your lua scripting is to simply start applying your knowledge! Even with the very basics you can create doors, cannons, keycards, and many of the simple assets needed to make a cool game. As you create more things, you will run into more problems and more questions, which will help you to learn more and expand your horizons!
  • look at other people’s scripts. Many of them are mind numbingly complex and filled with hundreds of mysterious numbers and math functions, so find scripts that are simple enough to understand (or figure out). So many new techniques can be learned by examining other’s works.
  • Believe that you can understand all of this! If you come into roblox scripting thinking it’s way too hard or way too complex, it will be. You will have psyched yourself out. Keep trying, and keep a positive attitude.
3 Likes

I’ve watched his beginner tutorials, and they contain a lot of outdated or just completely false information. (e.g. calling an object value a “global variable”)

1 Like

Most of the tutorials are actually still useful. Learned using his videos in 2017 and have a friend using his tutorials to learn right now.

Edit: apparently they’re not the greatest, didn’t see @posatta’s post. I still believe that the tutorials are still quite good for getting a hang of the basics.

Not that kind of “How to make…” videos but the really basic ones.
Like this playlist: https://www.youtube.com/playlist?list=PLsbxI7NIoTtgxJF0NF9FuhApCG_YaPQb8

First of all you should use https://developer.roblox.com to learn scripting or here is some tutorials made by Roblox: https://www.youtube.com/watch?v=dWisUXms3Sw&list=PLuEQ5BB-Z1PJ4JIDXpttxuvCzJMeIqzMi

For making a part move you can use this article: https://developer.roblox.com/api-reference/class/TweenService

You should checkout AlvinBlox’s tutorial on TweenService, you can make a smooth moving part with that method.

Hey! I will provide you with additional information aswell as the answer to your question.

So there are numerous ways to do this.

  • CFraming
  • Positioning
  • Body Movers

These are the 3 basic ways to move a part.

CFrame -
CFraming is the most commonly used one, since it holds both Orientation and Position in an object. It’s made up of 4 Vectors:

  • Position Vector
  • LookVector
  • RightVector
  • UpVector

The ones with the directional faces (Look, Right, Up) make up the Orientation of the Part or object. The Position Vector makes up the position of where the Part or Object is located at.

So with CFrame, we can move a part by doing: PartA.CFrame = PartB.CFrame * CFrame.new(3, 3, 3,) --XYZ This will Position a part 3 studs right, 3 studs up, and 3 studs foward.

Another use of CFrame is rotating objects, you can also combine the CFrame.new() and CFrame.Angles() constructors by using a multiply symbol:

Part.CFrame = Part.CFrame * CFrame.new(4,4,4) * CFrame Angles(math.rad(45), 0, 0)

CFrame.Angles() is used to rotate an object, you can use math.rad() to provide a radian angle, like 45, 90, or 180.

So, at your level. A summary of CFrame is just basically Position & Orientation combined in an object that can be manipulated with the CFrame constructors to change Pos or Orientation.

PartA.CFrame = Part.CFrame * CFrame.new(0, 0, 10) This is an another example of a part being moved, make sure you define your part first.

Positioning
Positioning isn’t the best way to move an object, since it doesn’t move the object based on it’s facing direction or relative to it’s orientation. I personally don’t use it and I would use CFrame over it.

Here’s a brief summary of Positioning though.

Every part or object will and most likely have a Position property. This describes the location of the object.

This property contains 3 axis values obviously, X, Y, and Z.
If you don’t know X describes left or right, Y describes up and down, Z describes foward and back.

If your part is rotated to the right 45 or 90 degress and you move your part right, it won’t move relative to where the part is facing based on that angle, that’s why CFrame is useful in this case.

To move a object with position, all you simply have to do is the following:
PartA.Position = PartA.Position + Vector3.new(3, 3, 3) This will move the object 3 studs right, 3 studs up, and 3 studs foward, not relative to where the part is facing though.

As you saw in the CFrame tutorial, we used the CFrame.new() and CFrame.Angles() constructor, for Position we use the Vector3 constructor. The Vector3 constructor essentially constructs a vector3 out of 3d space.

We can also use the Vector3 constructor for Orientation.
PartA.Orientation = PartA.Orientation + Vector3.new(45, 45, 45)

Body Movers
Body movers are a little bit different, the main Body movers you should use for positioning are:

  • BodyPosition
  • BodyVelocity

These are the most basic 2 body movers that you can use to move an object. When using any type of body mover, the Object must be Anchored in order for it to apply to the part.

All you have to do to get a body mover working is insert it into a Part and play around with it, for this tutorial I will be using BodyPosition since it identifies as Position, and Body Velocity is just a infinite velocity with speed and direction applied to it.

BodyPosition consists of 3 properties you should worry about I will use BP to reference Body Position

  • BP.Position
  • BP.P
  • BP.MaxForce

BP.P and BP.Position are not the same thing, BP.P describes how long it should take for the Body Position to reach it’s goal, keep in mind, body movers are smooth movements based on their applied speed to the BP.P property.

I usually will set my P property to 50000, my MaxForce to BP.MaxForce = Vector3.new(400000, 400000, 400000)

And for position, you can provide a position that you’d like to put in. For this tutorial, I’ll use 4,5,2

BP.Position = BP.Position + Vector3.new(4, 5, 2)
This will apply the Vector3 to the Position of the Body Position object.

I hope this helped!
I will now just kind of give you my thoughts on motivation and etc.

I have been scripting for 10 months now, I work on Anime games, particularly Dragon Ball. It is never easy to keep motivation, at all. For anyone, you will lose motivation some time sooner or later it just depends on your current state of reluctance to do something and your ideas you have.

When I first started scripting I was so bad, I watched a youtube tutorial on Custom Character, I read a comment that said “You have to unanchor the model, cmon guys.” I had no clue what he was talking about, see how bad I was? xD, I didn’t even know what Anchored meant. As I started progressing, I got better and better. I was in the same position as many other people are today where they are clueless, and trust me I’ve been there. a lot of times. You just gotta keep your head up and keep learning, if you got a question, just ask on the dev forum or look around on Google. Personally, what motivates me the most is getting better and learning. I’m currently getting better at advanced combat systems with different combos and it’s really fun because I’m learning a lot and making cool stuff. You do the same :smiley:

If got something wrong or there is something inaccurate in my post, please reply to me and correct me, thank you.

Have a nice day and keep on scripting :slight_smile:

8 Likes