So I have my datastore all perfectly made with API turned on, except it will not run properly. This might be a bug, but I put it here just in case I missed some update with datastores or something. Team create is off and this is a group game for extra information.
Script
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("Name Here")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local cash = Instance.new("IntValue")
cash.Name = "Boos"
cash.Parent = leaderstats
local data
local success, errormessage = pcall(function()
data = myDataStore:GetAsync(player.UserId.."-cash")
end)
if success then
cash.Value = data
else
print("There was a error with getting your data")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
myDataStore:SetAsync(player.UserId.."-cash",player.leaderstats.Boos.Value)
end)
if success then
print("Player Data Successfully Saved")
else
print("There was an error when saving data")
warn(errormessage)
end
end)
I also have HTTP Service turned on, but it didn’t affect anything before, so it shouldn’t be a problem.
No errors/prints show up in the output as well.
Thanks For Reading!