I am trying to make a point system but it wont load the amount. Did I do anything wrong? [closed]
local DataStore = game:GetService("DataStoreService")
local PointsData = DataStore:GetDataStore("PointsData")
game.Players.PlayerAdded:Connect(function(plr)
local Points = Instance.new("NumberValue",plr)
Points.Name = "Points"
local Data
local success, message = pcall(function()
Data = PointsData:GcetAsync(plr.UserId.."-Points")
plr.Points.Value = Data
end)
if success then
print("Success")
else
warn("Error Whilst loading. Error message: "..message)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, message = pcall(function()
PointsData:SetAsync(plr.UserId.."-Points", plr.Points.Value)
end)
if success then
print("Success")
else
warn("Error Whilst saving. Error message: "..message)
end
end)
Closed as Not Constructive by JesseSong
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?