I’ve been having issues with my DataStore and I am not popping off any errors in output. Hoping someone can take a look and let me know what’s going on.
I have gone through the script and checked everything over, made edits, etc and to no avail.
After that, you should include more details if you have any. Try to make your topic as descriptive as
Blockquote
local Datastore = game:GetService(“DataStoreService”):GetDataStore(“DataStore”)
game.Players.PlayerAdded:Connect(function(player)
local Folder = Instance.new("Folder", player)
Folder.Name = "StatData"
local Credits = Instance.new("IntValue", Folder)
Credits.Name = "cR"
local CreditsBank = Instance.new("IntValue", Folder)
CreditsBank.Name = "cRBank"
local Rock = Instance.new("IntValue", Folder)
Rock.Name = "Ore"
local Iron = Instance.new("IntValue", Rock)
Iron.Name = "Iron"
local Silicon = Instance.new("IntValue", Rock)
Silicon.Name = "Silicon"
local Nickel = Instance.new("IntValue", Rock)
Nickel.Name = "Nickel"
local Titanium = Instance.new("IntValue", Rock)
Titanium.Name = "Titanium"
local Platinum = Instance.new("IntValue", Rock)
Platinum.Name = "Platinum"
local Palladium = Instance.new("IntValue", Rock)
Palladium.Name = "Palladium"
local Phosphorus = Instance.new("IntValue", Rock)
Phosphorus.Name = "Phosphorus"
local ShipObject = Instance.new("ObjectValue", Folder)
ShipObject.Name = "Ship"
local Key = "User - " .. player.UserId
local storeditems = Datastore:GetAsync(Key)
if storeditems then
Credits.Value = storeditems[1]
CreditsBank.Value = storeditems[2]
Rock.Value = storeditems[3]
else
local Items = {Credits.Value, CreditsBank.Value, Rock.Value}
Datastore:SetAsync(Key, Items)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local Items = {player.StatData.cR.Value, player.StatData.cRBank.Value, player.StatData.Ore.Value}
local Key = “User-” … player.UserId
Datastore:SetAsync(Key, Items)
end)
Blockquote