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

Accessing DataStores from LocalScripts?

I'm trying to access a datastore from a localscript, but since localscripts don't have access to it, how would I do it? I've tried using RemoveEvents but I don't know how to do it with those.

1 answer

✓ Accepted answer

From the server, you will need to create an event to listen for a RemoteFunction to be fired by a client.

RemoteFunction.OnServerInvoke = function()
	return DataStore:GetAsync("key")
end

From the client, you will need to invoke the RemoteFunction:

local data = RemoteFunction:InvokeServer()

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