repeat wait() until game.Players.LocalPlayer ~= nil local player = game.Players.LocalPlayer player.PlayerScripts.ControlScript.Disabled = true repeat wait() until player.Character ~= nil
local DSService = game:GetService('DataStoreService'):GetDataStore(player.Name.."Stats")
local Character = player.Character
local uniquekey = 'id-'..player.userId
local Stats = Instance.new('IntValue', player)
Stats.Name = 'Data'
local Data2 = Instance.new('StringValue', Stats)
Data2.Name = 'Race'
Data2.Value = 'None'
local Data3 = Instance.new('StringValue', Stats)
Data3.Name = 'Speacialty'
Data3.Value = 'None'
local Data4 = Instance.new('StringValue', Stats)
Data4.Name = 'Speacialty2'
Data4.Value = 'None'
local Data5 = Instance.new('StringValue', Stats)
Data5.Name = 'EquippedGun'
Data5.Value = 'None'
local Data6 = Instance.new('StringValue', Stats)
Data6.Name = 'EquippedSword'
Data6.Value = 'None'
local Data7 = Instance.new('IntValue', Stats)
Data7.Name = 'Stamina'
Data7.Value = 1
local Data8 = Instance.new('IntValue', Stats)
Data8.Name = 'Level'
Data8.Value = 1
local Data9 = Instance.new('IntValue', Stats)
Data9.Name = 'Exp'
Data9.Value = 1
local Data10 = Instance.new('IntValue', Stats)
Data10.Name = 'MaxExp'
Data10.Value = 1000
local Data11 = Instance.new('IntValue', Stats)
Data11.Name = 'MaxStamina'
Data11.Value = 1000
local Data12 = Instance.new('IntValue', Stats)
Data12.Name = 'MaxHealth'
Data12.Value = 1000
local Data13 = Instance.new('StringValue', Stats)
Data13.Name = 'EquippedBlackleg'
Data13.Value = 'None'
local Data14 = Instance.new('StringValue', Stats)
Data14.Name = 'EquippedMelee'
Data14.Value = 'None'
local Data15 = Instance.new('IntValue', Stats)
Data15.Name = 'Melee'
Data15.Value = 0
local Data16 = Instance.new('IntValue', Stats)
Data16.Name = 'LevelMelee'
Data16.Value = 0
local Data17 = Instance.new('IntValue', Stats)
Data17.Name = 'MeleeMax'
Data17.Value = 0
local Data18 = Instance.new('IntValue', Stats)
Data18.Name = 'DevilFruit'
Data18.Value = 0
local Data19 = Instance.new('IntValue', Stats)
Data19.Name = 'LevelDevilFruit'
Data19.Value = 0
local Data20 = Instance.new('IntValue', Stats)
Data20.Name = 'MaxDevilFruit'
Data20.Value = 0
local Data21 = Instance.new('IntValue', Stats)
Data21.Name = 'Gun'
Data21.Value = 0
local Data22 = Instance.new('IntValue', Stats)
Data22.Name = 'LevelGun'
Data22.Value = 0
local Data23 = Instance.new('IntValue', Stats)
Data23.Name = 'MaxGun'
Data23.Value = 0
local Data24 = Instance.new('IntValue', Stats)
Data24.Name = 'Sword'
Data24.Value = 0
local Data25 = Instance.new('IntValue', Stats)
Data25.Name = 'LevelSword'
Data25.Value = 0
local Data26 = Instance.new('IntValue', Stats)
Data26.Name = 'MaxSword'
Data26.Value = 0
local Data27 = Instance.new('IntValue', Stats)
Data27.Name = 'Blackleg'
Data27.Value = 0
local Data28 = Instance.new('IntValue', Stats)
Data28.Name = 'LevelBlackleg'
Data28.Value = 0
local Data29 = Instance.new('IntValue', Stats)
Data29.Name = 'MaxBlackleg'
Data29.Value = 0
local Data30 = Instance.new('IntValue', Stats)
Data30.Name = 'AttributePoints'
Data30.Value = 0
local Data31 = Instance.new('IntValue', Stats)
Data31.Name = 'Beli'
Data31.Value = 0
local Data32 = Instance.new('StringValue', Stats)
Data32.Name = 'EquippedBoat'
Data32.Value = 'None'
local Data33 = Instance.new('IntValue', Stats)
Data33.Name = 'MeeleDamage'
Data33.Value = 0
local Data34 = Instance.new('IntValue', Stats)
Data34.Name = 'BlackLegDamage'
Data34.Value = 0
local Data35 = Instance.new('IntValue', Stats)
Data35.Name = 'DevilFruitDamage'
Data35.Value = 0
local Data36 = Instance.new('IntValue', Stats)
Data36.Name = 'GunDamage'
Data36.Value = 0
local Data37 = Instance.new('IntValue', Stats)
Data37.Name = 'SwordDamage'
Data37.Value = 0
local Data38 = Instance.new('BoolValue', Stats)
Data38.Name = 'HasData'
Data38.Value = true
game.Players.PlayerAdded:connect(function(plr)
-- GetAsync
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
Stats.Value = GetSaved[1]
Data2.Value = GetSaved[3]
Data3.Value = GetSaved[4]
Data4.Value = GetSaved[5]
Data5.Value = GetSaved[6]
Data6.Value = GetSaved[7]
Data7.Value = GetSaved[8]
Data8.Value = GetSaved[9]
Data9.Value = GetSaved[10]
Data10.Value = GetSaved[11]
Data11.Value = GetSaved[12]
Data12.Value = GetSaved[13]
Data13.Value = GetSaved[14]
Data14.Value = GetSaved[15]
Data15.Value = GetSaved[16]
Data16.Value = GetSaved[17]
Data17.Value = GetSaved[18]
Data18.Value = GetSaved[19]
Data19.Value = GetSaved[20]
Data20.Value = GetSaved[21]
Data21.Value = GetSaved[22]
Data22.Value = GetSaved[23]
Data23.Value = GetSaved[24]
Data24.Value = GetSaved[25]
Data25.Value = GetSaved[26]
Data26.Value = GetSaved[27]
Data27.Value = GetSaved[28]
Data28.Value = GetSaved[29]
Data29.Value = GetSaved[30]
Data30.Value = GetSaved[31]
Data31.Value = GetSaved[32]
Data32.Value = GetSaved[33]
Data33.Value = GetSaved[34]
Data34.Value = GetSaved[35]
Data35.Value = GetSaved[36]
Data36.Value = GetSaved[37]
Data37.Value = GetSaved[38]
Data38.Value = GetSaved[39]
else
local NumbersForSaving = {Stats.Value,Data2.Value,Data3.Value,Data4.Value,Data5.Value,Data6.Value,Data7.Value,Data8.Value,Data9.Value,Data10.Value,Data11.Value,Data12.Value,Data13.Value,Data14.Value,Data15.Value,Data16.Value,Data17.Value,Data18.Value,Data19.Value,Data20.Value,Data21.Value,Data22.Value,Data23.Value,Data24.Value,Data25.Value,Data26.Value,Data27.Value,Data28.Value,Data29.Value,Data30.Value,Data31.Value,Data32.Value,Data33.Value,Data34.Value,Data35.Value,Data36.Value,Data37.Value,Data38.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
GetSaved:SetAsync(uniquekey, NumbersForSaving)
Stats:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
print("Saving")
local uniquekey = 'id-'..plr.userId
local Savetable = {Stats.Value,Data2.Value,Data3.Value,Data4.Value,Data5.Value,Data6.Value,Data7.Value,Data8.Value,Data9.Value,Data10.Value,Data11.Value,Data12.Value,Data13.Value,Data14.Value,Data15.Value,Data16.Value,Data17.Value,Data18.Value,Data19.Value,Data20.Value,Data21.Value,Data22.Value,Data23.Value,Data24.Value,Data25.Value,Data26.Value,Data27.Value,Data28.Value,Data29.Value,Data30.Value,Data31.Value,Data32.Value,Data33.Value,Data34.Value,Data35.Value,Data36.Value,Data37.Value,Data38.Value}
DSService:SetAsync(uniquekey, Savetable)
print("Saved")
end)