Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to save items bought in a shop?

Asked by
trecept 367 Moderation Voter
6 years ago

Just a question on which method would I use to save items bought in a shop? E.g there are 50 different weapons in a shop and when someone buys an item it allows you to equip and unequip, and will allow you to equip/unequip when you leave and join later. Would I have to make a whole table of all items and see if the player owns each one?

0
Assuming you're using data stores, you could just save a table of all names of the tools that they have bought, then do a loop for the number of items in that table when they rejoin and look for them in the place where you keep your tools. zyrun 168 — 6y

1 answer

Log in to vote
0
Answered by
zblox164 531 Moderation Voter
6 years ago

I would use Data Store. Not writing a whole script though. I would put some sort of Value in the item (StringValue, IntValue). You don't need to save the item just save the value.

You will need to change the value when the player buys the item.

Example:

if item1.StringValue.Value == "Purchased" then
    -- Move the item to the player
else
    -- If the player does not own the item then return false
    return false
end

Do that for each item and save the value in a table and it should be really easy.

Ad

Answer this question