I tried both, and it errored. Is there any way around this?
Can you not refer to ReplicatedStorage or ServerStorage from a LocalScript?
4 answers
ReplicatedStorage does work in LocalScripts, as the contents are replicated in the client and server.
local repStorage = game.ReplicatedStorage:findFirstChild("WhateverName")
I've used it in my games.
However, ServerStorage cannot be accessed with LocalScripts, since it is only accessible by server. See here for more about that.
Using ServerStorage should work from a LocalScript, I have used it in LocalScripts.
Was the error that you were referring to ServerStorage, or something else?
2 comments
Well, in ServerStorage, I got that it wasn't a valid member of DataModel (a fancy name for game). And for ReplicatedStorage (which is what I'm really trying to index), I got attempt to index ReplicatedStorage (a userdata value). Yeah.
ServerStorage is a server-only object.
I still get the error (see OP) when I try to index Replicated Storage.
Here's my code:
for s in shopitems.Value:gmatch("%P+") do
if inventory.Value:gmatch(s) then -- errors
game.ReplicatedStorage(s):clone().Parent = player.Backpack
end
end
1 comment
Any ideas as to what can be the problem?
If it actually makes it to line 3, change the parenthesis to brackets on game.Replicatedstorage, and capitalize Clone:
game.ReplicatedStorage[s]:Clone().Parent = player.Backpack
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Haha, I was just about to ask about that. Thanks for the edit.