You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
-
What is the issue? The data store is not saving
-
What solutions have you tried so far? I tried to look over my code and find that the problem but i still don’t know what the problem is
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- Data Store
local DataStoreService = game:GetService("DataStoreService")
local RobuxDataStore = DataStoreService:GetDataStore("RobuxDataStore")
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Robux_Donated = Instance.new("IntValue")
Robux_Donated.Name = "R$ Donated"
Robux_Donated.Value = 0
Robux_Donated.Parent = leaderstats
local Robux_Earned = Instance.new("IntValue")
Robux_Earned.Name = "R$ Earned"
Robux_Earned.Value = 0
Robux_Earned.Parent = leaderstats
local Data
local Sucess, errormessage = pcall(function()
Data = RobuxDataStore:GetAsync(Player.Userid.."-R$")
end)
if Sucess then
Robux_Donated.Value = Data
Robux_Donated.Value = Data
else
if not Sucess then
warn(errormessage)
print("For some reason the last time you played your data has not saved please look and see if the servers are down if the servers are not down tell us in group and we will look into it and restore your lost data")
end
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
local Sucess, errormessage = pcall(function()
RobuxDataStore:SetAsync(Player.UserId.."-R$", Player.leaderstats.Robux_Earned.Value,Player.leaderstats.Robux_Donated.Value)
end)
if Sucess then
print("Data Sucessfully Loaded!!")
else
if not Sucess then
print("There was an error when saving data")
warn(errormessage)
end
end
end)
I got a problem where my data store is not having does anyone know the problem thanks for your help.