Issue when using datastore 2

What is the issue?
the issue is that when i use datastore 2 it doesn’t create a folder inside of the local player here is the script:

local datastore2 = require(1936396537)

local default = 0

local player = game.Players.LocalPlayer

game.Players.PlayerAdded:Connect(function()
	
	local points = datastore2("points")
	
	local folder = Instance.new("Folder", player)
	folder.Name = folder
	
	local skips = Instance.new("IntValue", folder)
	skips.Name = "skips"
	
	local function point(updatedValue)
		
		skips.Value = points:Get(updatedValue)
	end
	
	point()
	
	points:OnUpdate(point)
end)

game.Workspace.Part.ClickDetector.MouseClick:Connect(function(plr)
	
	local points = datastore2("points",plr)
	
	points:Increment(10,default)
	
end)
2 Likes

Hmm. Do you have any errors in the output?

“folder is not a valid member of Player”

Why are you doing this on the client? You have to handle datastores on the server.

the script is in server script service

Dont use that

Put player as an argument instead:
game:GetService(“Players”).PlayerAdded:Connect(function(Player)

1 Like

I don’t think you can can do that in a ServerScript. I needs to be local.

okay i will try that (30 chars)

No, dont do local please. For the love of memes dont.

Its datastore, dont let the client handle it. (plus it wouldn’t work regardless)

well ty but it didn’t worked (30chars)

Can you show your explorer window/error output? Also you have to make sure you’re actually using the Player argument.

Also another issue I see:

You didnt put player in?

When creating a datastore you will need to make sure to add a key with the player otherwise it will not work, so far you only added the key, but you forgotten to add the player next to the key.

I am also not sure why you created the Datastore twice, couldn’t you just create the variable of the Datastore as a global variable and then you can access it anywhere in the script?

i did all you guys told me to do but i still get errors

Capture25

i think i spoted the error (30 chars)

Can you show the explorer window of where the script is located at? (just incase :man_shrugging:)

And can you show the script you currently have rn

1 Like

nevermind i didn’t fixed the error and yeah here’s the screen:

test50

Can you show the script you currently have right now? You might’ve mistyped something.

every script? (30 characterss)

Just the script you showed before, the “Datastore 2” one.

You’ve attempted to name your folder inside the player to the variable folder, and have not provided a string.