ShopItems on ReplicatedStorage or ServerStorage - "attempt to index nil w getchildren"

Hi all,

So, I have a shop that works fine so long as I put the shop items in ReplicatedStorage.

But I’m concerned about exploiters, as well as possible RAM issues client side if I have a shop with MANY items…(they have to download every item everytime they log in if its in Replicated, I think?)…

So I started altering the shop, and put a RemoteFunction/InvokeServer in the client script in the shop. It requests the EventHandler(ServerScript) send it a table of the items.

I keep getting an “attempt to index nil with GetChildren” error.

I did the research, a lot of it, and was finally directed to the developerHub (derp - oof!)

The developerHub says:

"Non-Replicated Instances

If the value being sent is only visible to the sender, nil will be passed instead of the value. For example, if a server tries to pass a descendant of ServerStorage , the client listening to the event will see a nil value because that object isn’t replicated to the client."

So, this confuses me. I thought the whole point of remoteevent/RemoteFunctions was for this very situation (when you need something not replicated) ?

Am I forced to keep all shopitems in replicatedStorage?

If I do, will it force people with low ram, or low bandwidth, to wait for every item to download?

Will it slow their game experience with lag, lag, lag?

I’ve read about this quite a bit all around the forum. Sometimes people dont even seem to understand the question before they answer (nothing against those responders, they are trying)…

Thanks for all friendly responses.
(derp oof)

1 Like

Hang on let me explain, remoteevents cannot transfer items from ServerStorage to the client. You can also preload the shop items. Put them in replicatedstorage, and then add some security on the items like checking if the user owns the item.


Thanks for your response.

Well, just to be clear, I’m using a RemoteFunction for this…so that it can pass info back (RemoteEvents don’t pass info back)…

I’ve been coding roblox for 3 years or so… how would I check to see if the user owns the item… Hm… maybe I already have this in my code…

So…in my shop, I do have a check, before someone buys an item, that checks if they already own it - and it changes “Buy” button to “Equip?”… is this all you mean?

Or is there a way to stop Exploiters from just grabbing it out of replicated, and this is what you mean?

Also - should I be concerned that if the items are in replicated that my game will take forever to load? Or is this a noproblem?

Thanks again to all responders.
(derp oof)

What I mean, is your item a tool that you give to the player? If the exploiter takes it out of replicatedstorage, in that tool it should check if the item is owned. Also it doesn’t matter rather RemoteFunction or RemoteEvent. They can’t pass serverstorage stuff to the client.

1 Like

Thank you for clarification.

No, I don’t think I have anything in the tool that checks if the client owns it.

And thank you for the help!
(derp - oof - oof!)

Oh yeah…

If i have a lot of stuff in replicated, wont it slow load time of the game?

No one else has made this very clear (that I can find) in the forum.

It seems like loads of stuff in replicated would slow load time, and maybe give lag to low-ram players. Do you think thats true?

Thats the main reason I started putting it all in ServerStorage… Ram/Load worries… I’m less worried about Exploiters - they are a low percentage of people compared to players…really
(derp oof!)

Ohhh, theres a very simple solution for this, you can just preload all the assets at the beginning of the game, and then it won’t need to constantly download. I’m unsure if the rumor is true though.

1 Like

I’m sorry, but what do you mean… I could search it quickly, but since I have you real time…

Is there some thing I should do to pre-load apart from just putting it all in replicated?

Ok, I’m going to send you a sample of lua code.

--get content provider to preload--
local ContentProvider = game:GetService("ContentProvider")
for i,v in pairs(game.ReplicatedStorage:GetDescendants()) do
--actually preload the object--

I recommend putting this in a loading screen when the player first joins the game.

1 Like

Thanks, I’ll give it a shot. If I can ever help you out just let me know.
(derp oof!)

1 Like

No problem, now if you excuse me, I gotta go!