roblox – Error in DataStore2


I’m trying to make a clicker type game in roblox, although im pretty new to datastore2. I know how to use datastore but after getting just a :SetAsync() a few times a minute is too much for it as most people know. I watched an AlvinBlox tutorial on DataStore2, and have made a test with it (DataStore2 is successfully installed).

Error (also when using this the leaderstats aren’t working): Model.MainModule:566: DataStore2() API call expected {string dataStoreName, Instance player}, got {string, nil}

Scripts

Main Script In ServerScriptService with datastore2 (i know that dnacps wont be saved as im justing using that for a test rn):

local DataStore2 = require(1936396537)
local onClick = game.ReplicatedStorage:WaitForChild("onClick")
local displayClicks = game.ReplicatedStorage:WaitForChild("displayClicks")
local default = 0
local dnapc = 1

game.Players.PlayerAdded:Connect(function(player)

    local DNADS = DataStore2("dna",player)

    local leaderstats = Instance.new("Folder",player)
    leaderstats.Name = "leaderstats"

    local dna = Instance.new("IntValue", leaderstats)
    dna.Name = "DNA"

    local function dnaUpdated(updatedVal)
        dna.Value = DNADS:Get(updatedVal)
    end

    dnaUpdated(default)

    DNADS:OnUpdate(dnaUpdated)

end)

onClick.OnServerEvent:Connect(function(val)
    local DNADS = DataStore2("dna", player)

DNADS:Increment(dnapc, default)
    displayClicks:FireClient(val)
end)

LocalScript (in with gui, this game is gui focused):

local onClick = game.ReplicatedStorage:WaitForChild("onClick")
local displayClicks = game.ReplicatedStorage:WaitForChild("displayClicks")

script.Parent.Activated:Connect(function()
    onClick:FireServer()
end)

displayClicks.OnClientEvent:Connect(function(val)
    script.Parent.Parent:WaitForChild("DNA").Text = "DNA: "..val
end)

I hope this is enough to help.

Any help appreciated!