yeah sure thing
local DS = game:GetService("DataStoreService"):GetDataStore("MyDataSaver")
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character.Humanoid
wait()
local plr_key = "id_"..player.UserId
local saves = {
----------------------
---Class Info---
----------------------
player.Class,
----------------------
--Stats Saving Info--
----------------------
player.Coins,
player.TotalCoins,
player.Sapphires,
player.TotalSapphires,
player.Strength,
player.Sword,
player.Agility,
player.JumpPower,
player.Psp,
player.Endurance,
player["Total Power"],
----------------------
---Multipliers Info---
----------------------
player.Multi,
player.eMulti,
player.pMulti,
player.aMulti,
player.sMulti,
player.jMulti,
----------------------
---Quest Info---
----------------------
player.questNum,
player.hasClickedQuest,
player.QuestInfo.Stat,
player.QuestInfo["Value"],
-------SwordQuest--------
player.SwordquestNum,
player.hasClickedQuest,
player.SwordQuestInfo.SwordStat,
player.SwordQuestInfo["SwordValue"],
----------------------
---Safe Zone Info---
----------------------
player.Safe,
----------------------
--Powers Saving Info--
----------------------
player.Powers.hasAura,
player.Powers.hasFly,
player.Powers.hasEnergyPunch,
player.Powers.hasInvisiblity,
player.Powers.hasDefBall
}
-- SAVING DATA
local GetSaved = DS:GetAsync(plr_key)
if GetSaved then
print("Has Played Before!")
for i, v in pairs(saves) do
v.Value = GetSaved[i]
end
else
print("New Player!")
wait(1)
local plrGui = player:WaitForChild("PlayerGui")
local frame = plrGui:WaitForChild("TutorialGUI"):WaitForChild("Frame")
local text = frame:WaitForChild("TutorialText")
frame.Visible = true
text.Text ="Welcome "..player.DisplayName..", to The Server!"
local NFS = {}
for i, v in pairs (saves) do
table.insert(NFS, i, v.Value)
end
DS:SetAsync(plr_key, NFS)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character.Humanoid
local saves = {
---Class Info---
----------------------
player.Class.Value,
----------------------
--Stats Saving Info--
----------------------
player.Coins.Value,
player.TotalCoins.Value,
player.Sapphires.Value,
player.TotalSapphires.Value,
player.Strength.Value,
player.Sword.Value,
player.Agility.Value,
player.JumpPower.Value,
player.Psp.Value,
player.Endurance.Value,
player["Total Power"].Value,
----------------------
---Multipliers Info---
----------------------
player.Multi.Value,
player.eMulti.Value,
player.pMulti.Value,
player.aMulti.Value,
player.sMulti.Value,
player.jMulti.Value,
----------------------
---Quest Info---
----------------------
player.questNum.Value,
player.hasClickedQuest.Value,
player.QuestInfo.Stat.Value,
player.QuestInfo["Value"].Value,
-------SwordQuest--------
player.SwordquestNum.Value,
player.hasClickedQuest.Value,
player.SwordQuestInfo.SwordStat.Value,
player.SwordQuestInfo["SwordValue"].Value,
----------------------
---Safe Zone Info---
----------------------
player.Safe.Value,
----------------------
--Powers Saving Info--
----------------------
player.Powers.hasAura.Value,
player.Powers.hasFly.Value,
player.Powers.hasEnergyPunch.Value,
player.Powers.hasInvisiblity.Value,
player.Powers.hasDefBall.Value
}
DS:SetAsync("id_"..player.UserId, saves)
end)
game:BindToClose(function()
wait(3)
end)