Is the DataStoreService down? Or am I missing something?
local ds = game:GetService("DataStoreService")
local gd = ds:GetDataStore("GunData")
game.Players.PlayerAdded:Connect(function(plr)
local gdata = Instance.new("StringValue")
gdata.Name = "GunData"
gdata.Parent = plr
local data
local success, failure pcall(function()
data = gd:GetAsync(plr.UserId.."-guns")
end)
if success then
gdata.Value = data
else
plr:Kick("Datastore is NOT working")
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, failure pcall(function()
gd:SetAsync(plr.UserId.."-guns", plr.GunData.Value)
end)
if success then
print("Data Saved")
else
print("Data not saved (so sad)")
end
end)