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

How should I go about getting instances from the server and putting it on the client?

Asked by 4 years ago
Edited 4 years ago

I don't know how I should go about getting a instance from the server and putting it in the client

I have models in the server I need to return to the client for them to see

But to do that I need to use an remote event or function

and I noticed that for remote function returning the model, I have to parent the model thats getting returned to workspace, replicatedstorage or anything visible to the client first and then parent to the clients screengui because the client hasn't seen it

so when I do

RemoteFunction

return game.ServerStorage.Model

when I try get it on the client it will print nil

and theres also other things I noticed exploiters can spam the remote so that it lags since it makes it so that other people can see

1 answer

Log in to vote
1
Answered by 4 years ago

The problem with what you're doing is it doesn't just pass the instance into the remote function and the client can see it, what it's doing is sending a reference to the object when you pass it through the remote function. Since it is doing this, the client cannot see the reference when the instance is in an area the client cannot access like ServerStorage so it defaults to nil.

I would suggest putting the models to want replicated in ReplicatedStorage, that way the client and the server can see what is there.

0
Yes put the model in Replicated Storage and you don't even have to use remote events, you can just reference it from the local script Sulu710 142 — 4y
0
Exactly. CeramicTile 847 — 4y
Ad

Answer this question