of     1   

whyatt
#194183474Thursday, July 21, 2016 7:00 AM GMT

I am trying to refer to specific items in a system of folders within serverstorage. The problem is that the client can not directly refer to the ServerStorage. Therefore I index the items in the server storage. I use a remote call to then get the server to clone items out of the server storage however I have no way to refer to the correct item because the referral is coming from the remote call from the client which cant carry a link. I tried making the remote call carry the :GetFullName() of the child in the server storage that I am referring to however this wasn't working because :GetFullName() only givess a string value which cant be re-used to refer to a specific location. if the above insn't clear enough What i am trying to do is: I have tools in server storage but not directly in it but different tools in different folders and the amouunt of folders varies. A gui shop indexes a certain folder and these items can be clicked on the clients end. A remote call sends to the server the name of the player and what item he clicked on. The remote call need to then clone the correct item from server storage. <-- here is the problem (i cant refer to the item) If it was directly in server storage then yes i could send the item name along with it in the remote call however it in a complex series of folders to organise everything
Casualist
#194183578Thursday, July 21, 2016 7:04 AM GMT

" it in a complex series of folders to organise everything" So if it's organized you should be able to find it. If you can't it's not organized. That said, assuming everything has a unique name then local tool = ServerStorage:FindFirstChild("UniqueToolName_Here", true) if tool then --// clone tool and do something with it end Should do the trick
batistapowerbonbtla
#194187258Thursday, July 21, 2016 9:23 AM GMT

This is what happens when you guys keep telling noobs to use FE >tries to access ServerStorage on client >cant so decides to clone the object and send it using a RemoteFunction most likely >doesnt work so he tries to access ServerStorage on client... again
temprezors
#194188456Thursday, July 21, 2016 10:24 AM GMT

- Whar Are Filtiring Enabled? - What Are Remote Functions ? - What Are Remote Event ? Can someone Explain ? or give a source thanks i am a noob
batistapowerbonbtla
#194188986Thursday, July 21, 2016 10:47 AM GMT

FilteringEnabled decides if changes from the client should be replicated or not. RemoteEvent - Similar to BindableEvents, but allow crossing the client/server boundary. This allows a Server Script to call code in a Local Script and vice versa.
chimmihc
#194192760Thursday, July 21, 2016 1:03 PM GMT

"This is what happens when you guys keep telling noobs to use FE >tries to access ServerStorage on client >cant so decides to clone the object and send it using a RemoteFunction most likely >doesnt work so he tries to access ServerStorage on client... again" FE has nothing to do with this, that doesn't work either way.
pyth_n
#194192901Thursday, July 21, 2016 1:06 PM GMT

replicatedstorage confirmed - pyth_n
whyatt
#194213784Thursday, July 21, 2016 7:14 PM GMT

Yo, so I need to use replicated storage?
pyth_n
#194213871Thursday, July 21, 2016 7:15 PM GMT

yes... - pyth_n
whyatt
#194214258Thursday, July 21, 2016 7:20 PM GMT

So do you mean i should copy the entire contents of the server storage into ReplicatedStorage? Is replicated storage also in the local client? This would mean that the client would also have to load the entire serverstorage contents which im trying to bypass. I only want the client to load what it needs.
whyatt
#194214604Thursday, July 21, 2016 7:25 PM GMT

Let me say this: getting to the serverstorage isnt the problem the problem is relaying back to the server the location of a specific item in the ServerStorage tree. The wiki doesn't reccomend i Parse the :GetFullName() data.
pyth_n
#194220670Thursday, July 21, 2016 8:46 PM GMT

ReplicatedStorage is on both the server and the client. - pyth_n
TimeTicks
#194220990Thursday, July 21, 2016 8:50 PM GMT

This is the time to use remote functions. --server script local rf = game.ReplicatedStorage:WaitForChild('RemoteFunction') function rf.OnServerInvoke:connect(function(plr,val) local object = game.ServerStorage:FindFirstChild(val) if object then return object end end --local script local rf = game.ReplicatedStorage:WaitForChild('RemoteFunction') local part = rf:InvokeServer('Part1') if part then print(part.Name) end
whyatt
#194294177Friday, July 22, 2016 6:59 PM GMT

Okay, but something i am struggling with is: Doesn't it defeat the purpose of the ServerStorage if I copy everything into the replicated storage? Isn't it the point that only the server stores it so that the client can have smoother game-play without having to load things that are not being used?
TimeTicks
#194294591Friday, July 22, 2016 7:05 PM GMT

RemoteFunctions. --server local rf = game.ReplicatedStorage:WaitForChild('RemoteFunction') function rf.OnServerInvoke(plr,name) local tool = game.ServerStorage:FindFirstChild(name) if tool then return tool end end --client local rf = game.ReplicatedStorage:WaitForChild('RemoteFunction') local tool = rf:InvokeServer('Gun') if tool then print(tool.Name) end
pyth_n
#194294634Friday, July 22, 2016 7:06 PM GMT

The client can't see anything that's not on the client; and if you want to client to index it, it has to be on the client, doesn't it? Makes no sense otherwise e.e - pyth_n
whyatt
#194295656Friday, July 22, 2016 7:18 PM GMT

Yes, I know but i was trying to make it so that the client indexes only the specific thing they need with a remote function so that they don't have to index everything. But it seems that that is more complicating than it's worth.
Sacrificable
#194296105Friday, July 22, 2016 7:24 PM GMT

Just move the things you need indexed to replicated storage. Unless you're a free model user, I don't see the problem here.
TimeTicks
#194297125Friday, July 22, 2016 7:38 PM GMT

Its not clone complex. Just ask the server what tool the client wants, check if the tool exists in serverstorage, the server will then clone the tool into the players backpack. Not that difficult to understand
whyatt
#194304196Friday, July 22, 2016 9:09 PM GMT

I know, i'm trying to however make a general script where I can't refer to the specific location of the item inside the ServerStorage. However i have already thought of a solution. When the game runs I will re-index everything into the root of the replicated storage with a randomised name (a number val that can easily be tranferred) This would actually also work if I use the ServerStorage
whyatt
#205963543Saturday, December 31, 2016 1:07 PM GMT

And it ended up not working as smoothly as i wanted due to some of the randomized values being the same because they run at the same time.
Disillusions
#205964280Saturday, December 31, 2016 1:25 PM GMT

what some person said somewhere above (too lazy to look at who wrote it) FindFirstChild has an optional second argument, recursive it makes FindFirstChild look through the children of the object so say you use folder:FindFirstChild('hello') folder ->1 ->hello ->2 it would return nil here but folder:FindFirstChild('hello',true) --second is the recursive (bool) would return the hello object

    of     1