I have no problem saving cash, but how do I save things like values? (AKA, Boolvalues)
Lets say I have a tutorial only for new players, so if you first joined and viewed it your value will be set to true, then it will have to save as true when you leave so that you don’t watch the beginners tutorial over and over again.
You would use the exact same method as with saving coins, just using a boolean in place of an integer. Here’s an example:
local DataStore = game:GetService("DataStoreService"):GetDataStore("Tutorial")
game.Players.PlayerAdded:Connect(function(player)
local data
pcall(function()
data = DataStore:GetAsync("ID:"..player.UserId)
end)
if data then
-- User has completed tutorial
end
end)
game.Players.PlayerRemoving:Connect(function(player)
pcall(function()
DataStore:SetAsync("ID:"..player.UserId,TutorialValue)
end)
end)