#Tycoon Datastorage
15 messages · Page 1 of 1 (latest)
yeah i do
ok
Advanced Roblox Scripting Tutorial #13 - Data Store / Saving Player Data (Beginner to Pro 2019)
Hey guys, i know i've been gone for a while and i apologize for that but I am back and in today's video i am going to be teaching you guys about data stores and how they work. Basically saving player data. Anyways this a very long tutorial which is m...
does it show how to save the droppers tho
it shows how to save everything
ok
** You are now Level 1! **
local DataStoreService = game:GameService("DataStoreService")
local my DataStore = DataStoreService:GetDataStore("myDataStore")
game.Players.PlayerAdded:Connect(function(player)
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Cash = Instance.new("IntValue")
Cash.Name = "Cash"
Cash.Parent = leaderstats
local playerUserId = "Player_"..player.UserId
Local data
local sucess, errormessage = pcall(function()
data = myDataStore:GetAsync(playerUserId)
end)
if sucess then
Cash.Value = data
end
end)
game.Players.PlayersRemoving:Connect(function(player)
local playerUserId = "Player_"..player.UserId
local data = player.leaderstats.Cash.Value
local sucess, errormessage = pcall(function()
myDataStore:SetAsync(playerUserId, data)
end)
if sucess then
print(:Data sucessfully Saved!")
else
print(There was an error!")
warn(errormesssage)
end
end)
this is the datastore i made for my cash