Hi,

I have been trying to use a datastore for the past couple of days. (I know that's a lot) But I have had none of the tutorials, and wiki pages, work for me. And I just generally suck at scripting and would like some help. (Please)

The script I am currently working with is below.

Script 1: In ServerScriptService | Name: WaitServiceSave

require(script:WaitForChild('Level'))

Script 2: In WaitServiceSave^ | A Module Script

local module = {}
local DataStore = game:GetService("DataStoreService"):GetDataStore("ErrxrStudioSaver")


local StartingLevel = 0


game.Players.PlayerAdded:connect(function(plr)
 
 
local leaderstats = Instance.new("IntValue", plr)
leaderstats.Name = "leaderstats"

local Level = Instance.new("NumberValue", leaderstats)
Level.Name = "Gems"
Level.Value = StartingLevel
local Level1 = Instance.new("NumberValue", leaderstats)
Level1.Name = "Coins"
Level1.Value = StartingLevel



local SavedLevel = DataStore:GetAsync(plr.userId .. "-Level")
 if SavedLevel ~= nil then
  Level.Value = SavedLevel
 end
local SavedLevel1 = DataStore:GetAsync(plr.userId .. "-Level1")
 if SavedLevel1 ~= nil then
  Level.Value = SavedLevel1
 end

end)



game.Players.PlayerRemoving:connect(function(plr)
 local id = plr.userId
 local LevelValue = plr.leaderstats.Gems.Value
    DataStore:SetAsync(id.."-Level", LevelValue)
end)
game.Players.PlayerRemoving:connect(function(plr)
 local id = plr.userId
 local LevelValue1 = plr.leaderstats.Coins.Value
    DataStore:SetAsync(id.."-Coins", LevelValue1)
end)
return module

Please help,

Thank you,

-Wyatt