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

How to make a datastore for a purchased model? [closed]

Asked by
Glistre -7
6 years ago

This is my script that purchases models in the game, like droppers ... So I would like to place the object in a location such as player Backpack when they buy the object and save it to a Datastore, then when the player rejoins, have the player already have the object so that they do not have to rebuy it ...is that possible to do?

function Purchase(tbl)

        local cost = tbl[1]
        local tool = tbl[2]
        local stats = tbl[3]

        stats.Value = stats.Value - cost 


        Objects[tool.Object.Value].Parent = script.Parent.PurchasedObjects 
        print (tool.Object.Value)--this is actually the string name of save it will print when you buy it (e.g.,Dropper1, Dropper2...


        for i,v in pairs (game.Players:GetPlayers()) do
        if tool.Object.Value then   --me

        script.Parent.PurchasedObjects[tool.Object.Value]:Clone().Parent = v.Backpack --me  after finding obejct put in player backpack
        print ("clone placed in Backpack")    

        end

Closed as Not Constructive by hiimgoodpack, lukeb50, and PyccknnXakep

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?