i have my datastore script:
local Data = game:GetService("DataStoreService"):GetDataStore("AllData")
game.Players.PlayerAdded:Connect(function(plr)
local Folder = Instance.new("Folder",plr)
Folder.Name = "Nut"
local Coins = Instance.new("IntValue",Folder)
Coins.Name = "Coins"
local Moral = Instance.new("IntValue",Folder)
Moral.Name = "Moral"
print("Gave "..plr.Name.." Currency Data")
local Experience = Instance.new("Folder",plr)
Experience.Name = "Experience"
local Will = Instance.new("IntValue",Experience)
Will.Name = "Will"
local Skill = Instance.new("IntValue",Experience)
Skill.Name = "Skill"
local Strength = Instance.new("IntValue",Experience)
Strength.Name = "Strength"
print("Gave "..plr.Name.." Experience Data")
local Speed = Instance.new("Folder",plr)
Speed.Name = "Speed"
local Five = Instance.new("BoolValue",Speed)
Five.Name = "Five"
local Ten = Instance.new("BoolValue",Speed)
Ten.Name = "Ten"
local Fifteen = Instance.new("BoolValue",Speed)
Fifteen.Name = "Fifteen"
local Twenty = Instance.new("BoolValue",Speed)
Twenty.Name = "Twenty"
print("Gave "..plr.Name.." Speed Data")
local SavedItems = Data:GetAsync(plr.userId)
if SavedItems then
Coins.Value = SavedItems.Coins or 0
Moral.Value = SavedItems.Moral or 0
Will.Value = SavedItems.Will or 0
Skill.Value = SavedItems.Skill or 0
Strength.Value = SavedItems.Strength or 0
Five.Value = SavedItems.Five or false
Ten.Value = SavedItems.Ten or false
Fifteen.Value = SavedItems.Fifteen or false
Twenty.Value = SavedItems.Twenty or false
print(plr.Name.." had data")
else
Coins.Value = 0
Moral.Value = 0
Will.Value = 0
Skill.Value = 0
Strength.Value = 0
Five.Value = false
Ten.Value = false
Fifteen.Value = false
Twenty.Value = false
print(plr.Name.." didn't have data")
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local Saving = {["Coins"] = (plr.Nut).Coins.Value;
["Moral"] = (plr.Nut).Moral.Value;
["Will"] = (plr.Nut).Will.Value;
["Skill"] = (plr.Nut).Skill.Value;
["Strength"] = (plr.Nut).Strength.Value;
["Five"] = (plr.Nut).Five.Value;
["Ten"] = (plr.Nut).Ten.Value;
["Fifteen"] = (plr.Nut).Fifteen.Value;
["Twenty"] = (plr.Nut).Twenty.Value;}
Data:SetAsync(plr.userId, Saving)
print("Saved "..plr.Name.."'s Data")
end)
and when a player leaves the game i noticed it wasnt saving so i went on my alt joined and left the game and the console tells me that Will is not a valid member of Folder

6 comments
did it print anything?
when the player leaves no but it prints eveything else that is supposed to print
hm then idk
userId is decaperated use UserId and the parent parameter of Instance.new() is decaperated, so instead set the parent last
oops didnt notice i put userid and i didnt know about Instance.new() parent parameter being deprecated thanks
found out my problem i forgot to change the values from nut to their new location when i was moving them (line 60-66)