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
COMMUNITY QUESTION
how do I get tools to save after you leave or die?
1 answer
(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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
datastore