Getting Models from ServerStorage on the Client

Hello! I am working on optimizations, and I am currently stuck with getting stuff from the Server to the client.

Here is my approach so far:

Client

local Karts = ReplicatedStorage.ClientRequest.GetKarts:InvokeServer()
			print(Karts)
			for _, Bodies in pairs(Karts:GetChildren()) do
-- Keep going here

Server

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")

ReplicatedStorage.ClientRequest.GetKarts.OnServerInvoke = function(Player)
	local Karts = ServerStorage.KartParts:Clone()
	return Karts
end

And I keep getting this in the output:
image

The “Getting Karts” is from my Refresh function.

If you can help solve this, that would be appreciated!
Thanks in advance!

Instead of using ServerStorage, use ReplicatedStorage. ServerStorage can only be accessed by the server, ReplicatedStorage can be accessed by both the server and the client. They work exactly the same other than that.

I was doing that in the past, but I want to make my game faster by not storing models in ReplicatedStorage. With RemoteFunctions, shouldn’t I be able to get these models from ServerStorage?

I’m fairly certain you can’t pass models or parts through the server-client boundary besides using ReplicatedStorage. I’m not 100% certain about that but in my experience you have to use ReplicatedStorage for that to work

Ah, ok. At least, am I able to pass Instances at all (Like BinaryStringValues with Attributes?)

Maybe, I’ve never tried it. Try reading this article, it seems like a good resource for this.

1 Like

Unfortunately, stuff in ServerStorage cannot be passed through RemoteFunctions, which only makes RemoteFunctions useful in my opinion is Filtering.


Stuff has to be in ReplicatedStorage, but couldn’t I just do

local ThingIWant = ReplicatedStorage.Part

So I conclude that besides filtering stuff, RemoteFunctions are pretty useless.

1 Like