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

Whta Did I Do Wrong In This Variable? That Should Get The Inventory Folder in serverstorage

I tried to make a local variable and i did not work it just gives me a error i tried doing "FindFirstChild" it just says inventory is not a valid member of serverstorage and when i try "Waitforchild" it just do infiniteyield thing I tried normal way "game.ServerStorage.Inventory" samerror at FindFirstChild And When I Try "game:GetService('ServerStorage')" its the same error in FindFirstChild So What Do I Do? Btw

local ServerStorage = Game:GetService('ServerStorage')
local inventory = ServerStorage:WaitForChild('Inventory')

Thats The Variable Thanks! Its in a local scritpt btw

1 comment

0

it needs to be in a normal script remember local scripts only run on client and client cant access server storage

1 answer

It's most likely because you are using a LocalScript, the objects inside ServerStorage won't be replicated to the client

so it will always be empty

that's what caused the infinite yield, because it keeps waiting for "Inventory" to exist, but it never will.

9 comments

0

Ok i will try it Thanks!

0

Ok but what is the fix to this?cuz i need a local script to run my script.so how do i fix this?

0

You can use ReplicatedStorage instead of ServerStorage, if you need a storage on the client side

0

Oh ok

0

But is there any difference in serverstorage and replicatedstorage??

0

Replicated storage is replicated from server to client. Server storage is only on the server.

0

But can exploiters easily acess replicated storage?? Im sorry im just new to developing im very sorry

0

Yes, that is why you use server storage and remote events

0

And btw i need a storage for the client's Tool.Cuz i storethe tools in a folder.so when they join i can give them ther tools back.the script makes a folder everytime someone joins

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