Guys, someone can help me? I want to save a value in a model. But my script dont work.
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

2 comments
don't bite off more than you can chew
The first argument of
:SetAsync()is the key you're going to be using. This is usually a unique key, like if you were storing every player's data, but it can be general. The second argument is the actual data to be stored. I assume that you have your arguments backwards at line 14. I guessed that you want to store the value in workspace with the key "ohnub". If so, flip them around