Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local datastore2 = require(1936396537)
- local invfunc
- datastore2.Combine("InvTest", "Inventory")
- game.Players.PlayerAdded:Connect(function(playeradded)
- local inventory = datastore2("Inventory", playeradded)
- local invstat = Instance.new("StringValue")
- invstat.Name = "Item"
- invstat.Value = inventory:Get("A")
- inventory:OnUpdate(function(newsteps)
- print(tostring("changed: "..newsteps))
- end)
- if inventory:IsBackup() then
- inventory:ClearBackup()
- end
- end)
- function invfunc(player)
- coroutine.resume(coroutine.create(function()
- local inventory = datastore2("Inventory", player)
- local str = inventory:Get()
- warn(str)
- if string.len(str) <= 1 then
- game.ServerStorage.Items.A:Clone().Parent = game.Players[player.Name].Backpack
- else
- for i = 1, string.len(str) do
- print(string.sub(str, i,i))
- if game.ServerStorage.Items:FindFirstChild(string.sub(str, i,i)) then
- warn("found!")
- game.ServerStorage.Items[string.sub(str, i,i)]:Clone().Parent = game.Players[player.Name].Backpack
- end
- end
- end
- end))
- end
- game.ReplicatedStorage.Load.OnServerEvent:Connect(function(playertoload)
- invfunc(playertoload)
- end)
- game.ServerStorage.Events.AddItem.Event:Connect(function(playertostep, amount)
- local stepstore = datastore2("Inventory", playertostep)
- local str2 = stepstore:Get()
- stepstore:Set(tostring(str2..amount))
- end)
- game.ServerStorage.Events.ClearItems.Event:Connect(function(playertoclear)
- local invstore = datastore2("Inventory", playertoclear)
- invstore:Set("A")
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement