Ok im making an RPG game and datapersistance is not reliable to save stuff constantly so i need to make a datastore that saves stuff. I know they cant save instances or tools directly but i need to save them in a table.
Can someone please make the base script for me where i can put in the sword names. I Will give credit to whoever makes it and they will have their name in my game aslong as they want it. PLEASE HELP ive been trying to do this all week and cant figure it out --Copyed from forums
The easiest way to do this is by having a folder that stores all the tools and simply saving the name of the tools that the player has. That way to can clone the tool from the folder using if you know its name and give it to the player.
Loading Tools:
local dataStore = game:GetService("DataStoreService"):GetDataStore("Tools") local tools = game.ServerStorage.Tools game.Players.PlayerAdded:connect(function() local key = player.userId local userTools = dataStore:GetAsync(key) -- Table of tool names for _, tool in ipairs(userTools) do tools[tool].Clone().Parent = player.StarterGear end end) function giveTool(toolName) local key = player.userId local userTools = dataStore:GetAsync(key) tools[toolName].Clone().Parent = player.StarterGear table.insert(userTools, toolName) dataStore:SetAsync(key, userTools) end