Why wont my datastores work?

hello! Im having a problem with a datastores. Since I just follow a tutorial. So I will not talk much about it

I made a scripts inside a ScreenGui with a numbervalue called “Money”,

Scripts:

wait(0.1)
local datastore = game:GetService("DataStoreService")
local moneydata = datastore:GetDataStore("Money")
print("Money Checker Sytem Started")
game.Players.PlayerAdded:Connect(function(plr)
	local currentmoney
	local playerid = plr.UserId
	local maney = script.Parent.Money
	local sucess,errormessage = pcall(function()
		print("Let me seee")
		currentmoney = moneydata:GetAsync(playerid)
		return currentmoney
	end)
	if sucess then
		print("SUCESS OO")
		maney.Value = currentmoney
		script.Parent.TextLabel.Text = ""..maney.Value.."$"
	else
		warn("Oh oooo. Some error: "..errormessage)
	end
end)
game.Players.PlayerRemoving:Connect(function(plr)
	local currentmoney
	local playerid = plr.UserId
	local maney = script.Parent.Money
	local sucess,errormessage = pcall(function()
		print("Checking before leaves")
		 moneydata:SetAsync(playerid, script.Parent.Money.Value)
	end)
	if sucess then
		print("Sucess :O")
	else
		warn("Oh oooo. Some error: "..errormessage)
	end
end)

I tried debugging many times, reading roblox article.
But nothing seems to work.
I’ll give you more information if you want :smiley:

Thanks for reading :heart_eyes:

You could try using DataStore2 instead since it’s a bit better!

@Alvin_Blox also made a tutorial on it!

1 Like

Alright! Im going to try it, I’ll report any information of what I get from test :heart_eyes:
Thank you!

Your welcome!

Let me know if you need anything else.

1 Like

Well I never used a github before, could you send me the module file?

I did remember, but since it’s not related to the topic. You might need to delete it

The Devforum was down so I couldn’t reply.

The module

@bookgamery555gta It worked did it?

I didnt even use the module! :laughing: but I got a information that the datastores will work only in serverscriptsservice

Btw, thanks for helping