Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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

0
it needs to be in a normal script remember local scripts only run on client and client cant access server storage 3F1VE 257 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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.

0
Ok i will try it Thanks! Rgboffical_yt 40 — 3y
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? Rgboffical_yt 40 — 3y
0
You can use ReplicatedStorage instead of ServerStorage, if you need a storage on the client side Azure_Kite 885 — 3y
0
Oh ok Rgboffical_yt 40 — 3y
View all comments (5 more)
0
But is there any difference in serverstorage and replicatedstorage?? Rgboffical_yt 40 — 3y
0
Replicated storage is replicated from server to client. Server storage is only on the server. SteamG00B 1633 — 3y
0
But can exploiters easily acess replicated storage?? Im sorry im just new to developing im very sorry Rgboffical_yt 40 — 3y
0
Yes, that is why you use server storage and remote events SteamG00B 1633 — 3y
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 Rgboffical_yt 40 — 3y
Ad

Answer this question