Hello, I’m trying to send an object value to the client and its receiving it as nil, I’ve tried using different parts and that also doesn’t work, sending over folder objects did work.
Here is some parts of code that i tested and don’t work
My original code was sending a dictionary to player with all available plots, and other data about them, but there would not be a value for the part in the dictionary.
This is my original codes output, The third value is an object value
Havn’t read through it fully, but based off the title, I can make a general reason. Objects passed through the parameters of remotes does not work. Their are ways around it, but havn’t dealt with this in a while so can’t recall any ways to get around it atm.
Right did a quick search and it gave me an immediate answer so next time just search for it. It is because the part is not replicated for both sides and a workaround would be to have the part placed in replicated storage and make your code work around that.
I tried searching it up and nothing came up, what did you search up?
also i can index to the same part through the client with no problem. and the part needs to be in workspace i cant place it in replicated storage, I’ll try messing around with the part in replicated storage and see if i can make something work for my game,
Thanks btw
Remote functions work better for the code i have but its still not sending the part value, I’m just gonna have it send the parent and the name of it for now until i can find a better method, Thanks!
hm, maybe you could assign the part a unique attribute (like set an attribute called “UniqueId” and its value could be a unique number) on the server, send the number as a parameter, and on the client, search for an instance with the attribute UniqueId equal to that number
You’re experiencing an issue with replication time.
Because you are firing this event immediately when the player joins, the part has not yet be loaded on the client. Consider adding a loading screen, and then having the client request what slots are available, once the game is loaded.
probably like the above suggested the part is not yet loaded in when remote event is received.
i would suggest you tag those parts
for example, tag “farmlandPlot”, “wastelandPlot” (unique tags, or add attributes to distinguish different sub plots)
when you send/receive the sendplot remote use the tag,
then use CollectionService to GetTagged plot part. if it doesn’t exist yet, listen to OnInstanceAdded to wait for that plot to exist
if you want to keep it simple, you can also just send the path to the plot “farmland/Part”,
then when received, split the path by “/“,
and then use WaitForChild for each level
This may be something related to StreamingEnabled, I haven’t experienced this issue unless it can only send objects that are descendants of Models that have the Network Ownership set to the player.