local ds = game:GetService("DataStoreService") local BlocksMinedDS = ds:GetDataStore("BlocksMined02") local BlocksDS = ds:GetDataStore("Blocks02") local CoinsDS = ds:GetDataStore("Coins02") local SellingDS = ds:GetDataStore("Selling02") local BlocksDS = ds:GetDataStore("Blocks02") local isStudio = game:GetService("RunService"):IsStudio() local ownspds = ds:GetDataStore("Ownsp02") local equippedpds = ds:GetDataStore("Equippedp02") local ss = game:GetService("ServerStorage") local PicksF = ss:WaitForChild("Tools") local PacksF = ss:WaitForChild("Packs") local equippedpads = ds:GetDataStore("Equippedpa02") local ownspads = ds:GetDataStore("Ownspa02") local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local EquipPack = events:WaitForChild("EquipPack") local BuyPack = events:WaitForChild("BuyPack") local EquipPick = events:WaitForChild("EquipPick") local BuyPick = events:WaitForChild("BuyPick") game.Players.PlayerAdded:Connect(function(plr) local ls = Instance.new("Folder",plr) ls.Name = "leaderstats" local blocksmined = Instance.new("IntValue",ls) blocksmined.Name = "Blocks Mined" blocksmined.Value = BlocksMinedDS:GetAsync(plr.userId) or 0 local blocks = Instance.new("IntValue",ls) blocks.Name = "Blocks" blocks.Value = BlocksDS:GetAsync(plr.userId) or 0 local coins = Instance.new("IntValue",ls) coins.Name = "Coins" coins.Value = CoinsDS:GetAsync(plr.userId) or 0 local blocks = Instance.new("IntValue",ls) blocks.Name = "Blocks" blocks.Value = BlocksDS:GetAsync(plr.userId) or 0 local selling = Instance.new("IntValue",ls) selling.Name = "Selling" selling.Value = SellingDS:GetAsync(plr.userId) or 0 --code local packF = Instance.new("Folder",plr) packF.Name = "PackFolder" local ownspa = Instance.new("StringValue",packF) ownspa.Name = "OwnPacks" ownspa.Value = ownspads:GetAsync(plr.UserId) or "Classic Pack" local equippedpa = Instance.new("StringValue",packF) equippedpa.Name = "EquippedPack" equippedpa.Value = equippedpads:GetAsync(plr.userId) or "Classic Pack" repeat wait() until plr.Character ~= nil repeat wait() until plr.Character.UpperTorso ~= nil local char = plr.Character local PickF = Instance.new("Folder",plr) PickF.Name = "PickFolder" local ownsp = Instance.new("StringValue",PickF) ownsp.Name = "OwnPicks" ownsp.Value = ownspds:GetAsync(plr.UserId) or "Stone Pickaxe" local equippedp = Instance.new("StringValue",PickF) equippedp.Name = "EquippedPick" equippedp.Value = equippedpds:GetAsync(plr.userId) or "Stone Pickaxe" local ownspa = Instance.new("StringValue",packF) ownspa.Name = "OwnPacks" ownspa.Value = ownspads:GetAsync(plr.UserId) or "Classic Pack" local equippedpa = Instance.new("StringValue",packF) equippedpa.Name = "EquippedPack" equippedpa.Value = equippedpads:GetAsync(plr.userId) or "Classic Pack" repeat wait() until plr.Character ~= nil repeat wait() until plr.Character.UpperTorso ~= nil local char = plr.Character local pick = "Stone Pickaxe" if PicksF:FindFirstChild(equippedp.Value) then pick = equippedp.Value end local yPick = PicksF:FindFirstChild(pick):Clone() yPick.Parent = plr.Backpack print(yPick) local pack = "Classic Pack" if PacksF:FindFirstChild(equippedpa.Value) then pack = equippedpa.Value end local cPack = PacksF:FindFirstChild(pack):Clone() cPack.Name = "Backpack" local weld = Instance.new("Weld",cPack) weld.Part0 = char:FindFirstChild("UpperTorso") weld.Part1 = cPack cPack.Parent = char weld.Parent = cPack weld.C0 = CFrame.new(0,0,0.6) cPack.Capacity.Capacity.Disabled = false print(cPack) plr.CharacterAdded:Connect(function(char) repeat wait() until char.UpperTorso ~= nil for i,v in pairs(char:GetChildren()) do if v:FindFirstChild("TType") and v:FindFirstChild("TType").Value == "Pickaxe" then v:Destroy() end if v.Name == "Backpack" then v:Destroy() end end for i,v in pairs(plr.Backpack:GetChildren()) do if v:FindFirstChild("TType") and v:FindFirstChild("TType").Value == "Pickaxe" then v:Destroy() end end local pick = "Stone Pickaxe" if PicksF:FindFirstChild(equippedp.Value) then pick = equippedp.Value end local yPick = PicksF:FindFirstChild(pick):Clone() yPick.Parent = plr.Backpack print(yPick) local pack = "Classic Pack" if PacksF:FindFirstChild(equippedpa.Value) then pack = equippedpa.Value end local cPack = PacksF:FindFirstChild(pack):Clone() cPack.Name = "Backpack" local weld = Instance.new("Weld",cPack) weld.Part0 = char:FindFirstChild("UpperTorso") weld.Part1 = cPack cPack.Parent = char weld.Parent = cPack weld.C0 = CFrame.new(0,0,0.6) cPack.Capacity.Capacity.Disabled = false print(cPack) end) end) function save(plr) if isStudio == false then local ls = plr:WaitForChild("leaderstats") local blocksmined = ls:WaitForChild("BlocksMined") local blocks = ls:WaitForChild("Blocks") local coins = ls:WaitForChild("Coins") local st = plr:WaitForChild("leaderstats") local selling = st:WaitForChild("Selling") local blocks = st:WaitForChild("Blocks") local packF = plr:WaitForChild("PackFolder") local PickF = plr:WaitForChild("PickFolder") local ownspa = packF:WaitForChild("OwnPacks") local ownsp = PickF:WaitForChild("OwnPicks") local equipped = packF:WaitForChild("EquippedPack") local equippedp = PickF:WaitForChild("EquippedPick") BlocksMinedDS:SetAsync(plr.userId,blocksmined.Value) BlocksDS:SetAsync(plr.userId,blocks.Value) CoinsDS:SetAsync(plr.userId,coins.Value) SellingDS:SetAsync(plr.userId,selling.Value) BlocksDS:SetAsync(plr.userId,blocks.Value) ownspds:SetAsync(plr.userId,ownsp.Value) ownspads:SetAsync(plr.userId,ownspa.Value) equippedpds:SetAsync(plr.userId,equippedp.Value) equippedpads:SetAsync(plr.userId,equipped.Value) else print("Bruh") --FILLER-- end end game.Players.PlayerRemoving:Connect(function(plr) save(plr) end) --[[game.OnClose = function() for i,v in pairs(game.Players:GetPlayers()) do save(v) end end]]-- EquipPack.OnServerEvent:Connect(function(plr,part) local packF = plr:WaitForChild("PackFolder") local equipped = packF:WaitForChild("EquippedPack") local ownpacks = packF:WaitForChild("OwnPacks") if string.find(ownpacks.Value,part.PackName.Value) then equipped.Value = part.PackName.Value if plr.Character then if plr.Character:FindFirstChild("Backpack") then plr.Character:FindFirstChild("Backpack"):Destroy() end local cPack = PacksF:FindFirstChild(part.PackName.Value):Clone() cPack.Name = "Backpack" local weld = Instance.new("Weld",cPack) weld.Part0 = plr.Character:FindFirstChild("UpperTorso") weld.Part1 = cPack cPack.Parent = plr.Character weld.Parent = cPack weld.C0 = CFrame.new(0,0,0.6) cPack.Capacity.Capacity.Disabled = false end end end) BuyPack.OnServerEvent:Connect(function(plr,part) local ls = plr:WaitForChild("leaderstats") local money = ls:WaitForChild("Coins") local packF = plr:WaitForChild("PackFolder") local equipped = packF:WaitForChild("EquippedPack") local ownpacks = packF:WaitForChild("OwnPacks") if not string.find(ownpacks.Value,part.PackName.Value) then if money.Value >= part.Price.Value then money.Value = money.Value - part.Price.Value ownpacks.Value = ownpacks.Value .. "," .. part.PackName.Value equipped.Value = part.PackName.Value if plr.Character then if plr.Character:FindFirstChild("Backpack") then plr.Character:FindFirstChild("Backpack"):Destroy() end local cPack = PacksF:FindFirstChild(part.PackName.Value):Clone() cPack.Name = "Backpack" local weld = Instance.new("Weld",cPack) weld.Part0 = plr.Character:FindFirstChild("UpperTorso") weld.Part1 = cPack cPack.Parent = plr.Character weld.Parent = cPack weld.C0 = CFrame.new(0,0,0.6) cPack.Capacity.Capacity.Disabled = false end end end end) EquipPick.OnServerEvent:Connect(function(plr,part) local pickF = plr:WaitForChild("PickFolder") local equipped = pickF:WaitForChild("EquippedPick") local ownpicks = pickF:WaitForChild("OwnPicks") if string.find(ownpicks.Value,part.PickName.Value) then equipped.Value = part.PickName.Value if plr.Character then for i,v in pairs(plr.Character:GetChildren()) do if v:FindFirstChild("TType") and v:FindFirstChild("TType").Value == "Pickaxe" then v:Destroy() end end for i,v in pairs(plr.Backpack:GetChildren()) do if v:FindFirstChild("TType") and v:FindFirstChild("TType").Value == "Pickaxe" then v:Destroy() end end local cPick = PicksF:FindFirstChild(part.PickName.Value):Clone() cPick.Parent = plr.Backpack end end end) BuyPick.OnServerEvent:Connect(function(plr,part) local ls = plr:WaitForChild("leaderstats") local money = ls:WaitForChild("Coins") local pickF = plr:WaitForChild("PickFolder") local equipped = pickF:WaitForChild("EquippedPick") local ownpicks = pickF:WaitForChild("OwnPicks") if not string.find(ownpicks.Value,part.PickName.Value) then if money.Value >= part.Price.Value then money.Value = money.Value - part.Price.Value ownpicks.Value = ownpicks.Value .. "," .. part.PickName.Value equipped.Value = part.PickName.Value if plr.Character then for i,v in pairs(plr.Character:GetChildren()) do if v:FindFirstChild("TType") and v:FindFirstChild("TType").Value == "Pickaxe" then v:Destroy() end end for i,v in pairs(plr.Backpack:GetChildren()) do if v:FindFirstChild("TType") and v:FindFirstChild("TType").Value == "Pickaxe" then v:Destroy() end end local cPick = PicksF:FindFirstChild(part.PickName.Value):Clone() cPick.Parent = plr.Backpack end end end end)