![]() The structure of my Lua script is designed to work with various modules and RemoteEvents in my Roblox game. If data and type(data) = "table" and data.Coins and data.Gems then Local leaderstats = createLeaderstats(player)ĭata = playerDataStore:GetAsync(playerUserId) PlayerDataStore:SetAsync(playerUserId, data) Local success, errorMessage = pcall(function() Local playerUserId = tostring(player.UserId) Local leaderstats = player:FindFirstChild("leaderstats") Local Gems = Instance.new("IntValue", leaderstats) Local Coins = Instance.new("IntValue", leaderstats) Local leaderstats = Instance.new("Folder", player) Local playerDataStore = DataStoreService:GetDataStore("PlayerData") Here's the code I'm using: local DataStoreService = game:GetService("DataStoreService") The script I'm using is supposed to save players' Coins and Gems values when they leave the game and load them when they join, but it doesn't seem to be working as expected. ![]() I'm working on a Roblox game, and I'm having trouble with saving and loading player data using DataStore.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |