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
Thanks for reading