Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to save a value in workspace with DataStore?

Someone can help me? i want to make a data store to save a value in a model, but dont work my script

script:

local DataStoreService = game:GetService("DataStoreService")
local msgstore = DataStoreService:GetDataStore("HouseStore") --Value that saves the message

local success, key = pcall(function()
    return msgstore:GetAsync(game.Workspace.House.Owner.Value)
end)


local key = game.Workspace.House.Owner.Value   

if success then
    print("Success!")
else
    msgstore:SetAsync(key, "ohnub")
end

1 answer

I assume that you want to store the value of the owner of the house in the workspace. Instead of putting the value in the model in the workspace, you can simply put it in the player (not the character). And then, you can save it via DataStores.

May I know that the owner of the house can be changed frequently or is fixed? (It will help me to provide you the best solution!)

This discussion is preserved as it was. New answers, comments, and votes are closed.