Owned Vehicle System

Hello, I’m making a game where you can purchase and spawn pirate ships.

How would I go about storing what ships the player owns? I saw a popular method utilizing tables but have no clue how to even start. What type of script, where does it go, etc. All I need is a system to store owned ships for each player and a have a way to add and check what ships are owned (for an inventory gui to load the owned ships onto which the player can spawn) Thanks, I just need some ideas on how to execute this!

use tables and data store, for example:

local cars = {}

create car:

function CreateCar(carName)

table.insert(cars, {
uid = HttpService:GenerateGUID(),
name = carName}

datastore:UpdateAsync(storeKey, cars)

1 Like

Thanks for the start
Should this be serverscript, how should I assign a table to each player

CreateCar(player, carName)
if cars[player.UserId] == nil then
cars[player.UserId] = {}
end
end

is this a serverscript with playeradded to initiate

This is way to hard to just answer or provide code for … so a LINK it is.
This uses DataStore2, so it’s an to a up-to-date DataStore method.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.