DataStore Not correct work {}

  1. What do you want to achieve? When I use through the event {Where they give money} I do not save in the game

  2. What is the issue?

local dataStore = game:GetService("DataStoreService")
local Data = dataStore:GetDataStore("Stats")
game.Players.PlayerAdded:Connect(function(PLR)
	
	local Money = Instance.new("NumberValue")
	Money.Name = "Money"
	Money.Parent = leaderstats
	
	local MoneyValue = Data:GetChildren(PLR.UserId.."-Money")
	if MoneyValue ~= nil then
		PLR.leaderstats.Money.Value = MoneyValue
	end
	
	game.Players.PlayerRemoving:Connect(function(PLR)
		
	local sussec, errorMsg = pcall(function()
		Data:SetAsync(PLR.UserId.."-Money", PLR.leaderstats.Money.Value)
	end)
  1. What solutions have you tried so far? I look in Tutorial DataStore In youtobe its not help me.
4 Likes

Iā€™m having major issues with the datastore myself. On code that was working fine.
They must be changing something. Make a back up of your scripts before wiping them out.

2 Likes

Okei get it i save scripts and game.

try this:

Data:GetAsycn(PLR.UserId.."-Money")

What Changed? the getasycn, always use getasync, i have never used getchildren and i dont think it works.

1 Like

Wrong method. Probably autocompleted to the wrong one. Should be Data:GetAsync(PLR.UserId.."-Money")

1 Like

did you turn on enable studio access to api services? Its located in the Game Settings > Security tab.

2 Likes

I have a script for datastore that I could lend to you if you want.

1 Like

Yes am on it so yea you get it

No thx i just try creating My datastore to get exparancy {sorry for to late}

Thx for help me @Find4U2Go @DanTDMbonici @BilonGamer @epaes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.