Requesting folder from ServerStorage returning nil

I’m creating a simple shop system to test it out. I’m requesting a folder to set as an ObjectValue’s value. I have to create a regular script so it can access content inside of ServerStorage. When I click the button it returns nil. How do I get the folder and set it to the ObjectValue’s value?

Handler:

local RequestFolder = game.ReplicatedStorage:WaitForChild("RequestFolder")

local ServerStorage = game:GetService("ServerStorage")

RequestFolder.OnServerEvent:Connect(function(Player, Collection)

RequestFolder:FireClient(Player, ServerStorage.ShopItems[Collection])
end)

Button Script:

local RequestFolder = game.ReplicatedStorage:WaitForChild("RequestFolder")
local Value = script.Parent.Value
local Button = script.Parent

Button.MouseButton1Click:Connect(function()
	RequestFolder:FireServer(script.Parent.Name)
	
	RequestFolder.OnClientEvent:Connect(function(Collection)
		Value.Value = Collection
		wait(1)
		print(Value.Value)
	end)
end)

It’s just saying “nil” in the output.

Thanks,
Skylexion

Instances cannot be sent through remote events unless they exist on the client and server.

ServerStorage's empty on the client, you have to use ReplicatedStorage or move the object out of ServerStorage(a clone at least, maybe) in order for the client to ‘access’ it. Then you can probably pass the reference.

If initial reference passed isn’t working even with the provided steps, you can try passing other pieces of data that you can use to refer to the instance.

Could I use a remotefunction and send it through? I’m using the RemoteEvent so I don’t have to Invoke the client which says it may be game breaking.

All you gotta know is whatever you use, you can’t send a Model that doesn’t exist in the client, but you can send their data. Data EX: Values, Name, idk Price? etc

No instances can never be sent from remote functions or remote events unless they exist on the client and server. This is because it sends a reference, for example ‘client, here is an instance location get the object from there, please.’

You need to access the value directly, because the object/instance from ServerStorage cannot be read from the client since it doesn’t have access to it, hence it returning nil

Send ObjectValue.Value to the client instead.

Put the folder in ReplicatedStorage | Roblox Creator Documentation as in ServerStorage it can only be seen from the server.