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

how do I get tools to save after you leave or die?

Asked by 4 years ago

I'm making a simulator game and I want to make it so you don't have to buy an item again after you die or leave. I've looking all the over the internet and I can't seem to find anything that works

0
datastore Shubu13 29 — 4y

1 answer

Log in to vote
0
Answered by
Shubu13 29
4 years ago
Edited 4 years ago

(I may be wrong I'm new to scripting) You would need a value to assign a person a tool and after you have that value you can just datastore, for example:

--//DataStore (I'm too lazy to do it but here take this :p)
game.Players.PlayerAddded:Connect(function(plr)
    local stats = Instance.new("Folder", plr)
    stats.Name = "Stats"

    local knife = Instance.new("StringValue", stats)
    knife.Name = "Knife"
    knife.Value = "N/A"
    --//DataStorage Goes Here
end
--//Check Tool
game.Players.PlayerAdded:Connect(function(plr)
    if player.Stats.Tool.Value == "BoxKnife" then
        local boxknife = game.ServerStorage.Tools.BoxKnife
        boxknife.Parent = game.StarterPack
    end
end
--//GiveTool(Lets say you buy them by pressing a button)
script.Parent.MouseButton1Click:Connect(function(plr)
    script.Parent.Text = "BOUGHT"
    plr.Stats.Knife.Value = "BoxKnife"
end

Something Like This (I thought of that in half a minute)

Ad

Answer this question