How would I convert this to a table form?

I have this part in my script where like every car gets it’s own unique identifier, but problem is I dont want to use actual objects in game, how can I change it so that its table oriented basically

local ID = Instance.new("IntValue")
ID.Name = "ID"
ID.Value = math.random(1,500000000)
ID.Parent = car

Maybe you could use a method to create a new object:

local car_objects = {} --//Storage for all car tables

local function Create_Car(car_model)
local car = {}

car.ID = math.random(1, 5000000000)
car.car_model = car_model

table.insert(car_objects, car)
end

Not really sure what you need, but here’s a rough draft.

2 Likes

Oh thats like object oriented programming, kinda

Yeah. Is that what you wanted?

Hold on you gave me an idea let me test something really quickly

Exactly the type of solution I was looking for it works like a charm, good stuff. @C_Sharper

1 Like