What should I learn first about scripting

I just need help big time from you devs

1 Like

you have to learn programming fundamentals like statements and conditions and operators etc…
then learn Roblox API and How To Use it .

It depends of what you want to achieve.

cloning objects, closest part finder, and then pathfinding npc then u can switch into advanced scripting

You should learn all about the basics

Take your time to read about this as it took me around 5 minutes to write lol

I will probably come back and add to this in the future

-- Variables
local a = 1 -- the variable "a" is equal too an integer value of 1.
local b = "Hi" -- the variable "b" is equal too a string value which is "Hi"

-- Conditions
if a == b then -- Here we are checking a and b are equal too eachother, which means we are just seeing if they hold the same value.
  print("A => B")
else -- And under this is the code we will run if they condition fails, which will happen, because a (1) is not equal to b ("Hi")
  print("A ~ B")
end

-- Operators
--[[
 - Not Equal Too - ~=
 - Equal Too - ==
 - Greater Than - >
 - Greater Than Or Equal Too - >=
 - Less Than - <
 - Less Than Or Equal Too - <=
 -- There Is Probably More, but these are the main ones
]]

-- Functions
-- Functions are quite easy to get, but look advanced (from a beginner's pov)

local function1 = function() -- stating the function
  print("You Called Function 1!")
end

function1() -- calling the function

local function function2() -- Complete Same As The Other Function But Named Differently And Stated Differently
  print("You Called Function 2")
end

function2()

-- Returning Data and Tables

local tab = { -- Making Table Called "tab"
 ["Apple"] = 5, -- Setting a Key / Index called "Apple" which has a value of 5
 ["Banana"] = 7, -- Same Above But "Banana" and 7
}

local function getFruitsValue(fruit) -- function with an argument.
  for index, value in next, tab do -- looping through the table
     if index == fruit then -- checking if the index is equal to the inputted fruit
      return value -- if it is equal, then return the value, callbacks a value after calling the function.
   end
  end
end

print(getFruitsValue("Banana")) -- 7

-- More About Loops

for i,v in next, game:GetService("Workspace"):GetChildren() do -- looping through workspace and getting the children of the workspace
   if v.Name == "Apple" then -- checking if the name of the child is Apple
     v.Name = "Banana" -- if it is "Apple", then change the name to "Banana"
   end
end

-- Object Orientated Programming

local car = {} -- table called "car"
car._speed = 50 -- variable inside the table called _speed which holds a value of 50
car._steeringSpeed = 15 -- variable inside the table called _steeringSpeed which holds a value of 15

function car:ChangeSpeed(value)
   self._speed = value -- self gets the table the function is inside of
   -- we are also setting the _speed variable to the value the argument "value" is
end

print(car._speed) -- 50

car:ChangeSpeed(123) -- calling the "car" 's function called "ChangeSpeed" and passing through an argument with an integer value of 123

print(car._speed) -- 123
2 Likes

ok i will put that on my list ty also sunken that will help a lot ty everyone

You gotta start from the basics like how to use or create variables, tables etc. also watch some famous youtubers , basic tutorial like alvinblox or the devking, i learnt from them.

kk that will help a lot i will put that on my list

As multiple people mentioned, start with the basics, a basic scripting series should do good for that:

Now that you have familiarized yourself with the basics, you should now move on to trying to make some simple-ish things and when (or if) you get stuck loon it up. Another big thing that helped were watching videos on “How to make …. Game” and playing with the scripts to really understand what it does.

My channel, along with many others could be of use to you as I cover the basics, “how to make …”, and some extra random stuff.

I’m right here if you want to check it out: https://www.youtube.com/c/thescriptinglegend

ok thank you domboss this will help a lot