Help with datastoreservice and key

Hello, I am currently making a game where a user can post a slide, and other users can see it in different servers. I need help with saving it in a datastore so other users can see it.

I am confused what the key should be, should it be the UserId, and if so, how would I be able to access every post posted by every users that have created a post?

local DataStoreService = game:GetService('DataStoreService')
local Players = game:GetService('Players')

local PostStoreTesting = DataStoreService:GetDataStore("PostStoreTesting")

local Posts = {}


Players.PlayerAdded:Connect(function()
	local succ,err = pcall(function()
		local GetPosts = PostStoreTesting:GetAsync()
		 
	end)
end)

1 Like

I would like to apologies for this poorly written post, the solution has been solved.

A key can be any string value, people typically like to use a prefix like “Key_” followed by the user ID of the player whom which you are currently saving the data for.

local Key = "Key_"..Player.UserId
1 Like