.new doesn’t necessarily do anything. When you use OOP(Object Oriented Programming), you create simple, lets say description of an object. This might include functions. You Create table where you “describe” this particular object and you do that with Function like this
local Vehicles = {}
Vehicles.__index = Vehicles
function car.whatever(Speed, SuspensionHeight, Model, Position)
local Car = {}
setmetatable(Car, Vehicles)
Car.Speed = Speed
Car.SuspensionHeight = SuspensionHeight
Car.Model = Model
Car.Position = Position
return Car
end
function Vehicle:Spawn()
Vehicles.Car.Model.PrimaryPartCFrame = CFrame.new(Car.Positoin)
end
now if I ever want to create a new Car all I have to do is this:
Car = Vehicles.whatever(120, 4, game.ServerStorage.Corvette, vector3.new(27, 0, 17))
Car:Spawn()
As you can see .new is just name of the function. So what it does depends on what you make it to do. See THIS for great OOP Community Tutorial. I’m new to OOP myself so there might be mistakes in my code, but generally, answer to your question is that:
.new is just name of a function inside table , or metatable to be precise.