Trying to make a instagram in roblox

I was doing a instagram system to my game, the UI is all done i think but i was wondering how i would do it with datastore, i made a short system that allows the users to search for players but when you click in the name that pop up in the search system you can’t open the profile with the data saved in the person profile. Here’s the script that should open the profile(im new to this type of datastore so i don’t really know how to use it)

local DataStoreService = game:GetService("DataStoreService")

local IG = DataStoreService:GetDataStore("PCLig")

script.Parent.MouseButton1Click:Connect(function()
	local Profile = script.Parent.Text
	local ID = game.Players:GetUserIdFromNameAsync(Profile)
	local plr = game.Players:GetPlayerByUserId(ID)
	local Template = script.Parent.Parent.Parent.Parent.Parent.Template
	
	Template.Pname.Text = plr.Name
	local success, discoveredDataStore = pcall(function()
		IG:GetAsync("PFP"..plr.UserId)
	end)
	local success2, discoveredDataStore2 = pcall(function()
		IG:GetAsync("DESC"..plr.UserId)
	end)
	if success then
		if discoveredDataStore then
			for i,data in pairs(discoveredDataStore) do
				Template.PFP.Image = data[1]
			end
		end
	end
	if success2 then
		if discoveredDataStore2 then
			for i,data in pairs(discoveredDataStore2) do
				Template.Desc.Text = data[1]
			end
		end
	end
end)
1 Like

Is the code you’re showing a Script or a LocalScript?

In the documentation, DataStoreService can only be used by a Script or a ModuleScript used by a Script

1 Like

oh i did by local script, imma try script and see

1 Like

still the same thing… any other idea?

Because you need to use a localscript for handling the click detection, and a server script for getting the players information, and returning that to the client. RemoteEvent

will try it, thanks for suggesting

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.