RemoteFunction not returning object

Hello! I’m creating a CAD system, and I’m currently working on the ATTACH button.

Goal

  • Local script will send a request to a RemoteFunction where the server will check all the active calls and find the call ID in a folder. If the call exists, it will return the call (folder with data) to the local script.
  • The local script will then use the data to fill out the information on the CAD.

Actual

  • Server finds the call and supposedly returns the call folder
  • Local script prints an error stating that the returned value is NIL

Photos

LOCAL SCRIPT

SERVER SCRIPT


If you try to pass an instance from server to client, but the instance does not exist on that client (for example if its in server storage), the instance returned will be nil.

im not sure but ill try to fix it (since i am a beginner)

In the script where

game.ReplicatedStorage.CAD.AttachCall.OnServerEvent:Connect(function(player, ID) 

is maybe change it to

game.ReplicatedStorage.CAD.AttachCall.OnServerEvent:Connect(function(ID, player)

again not sure

Where could I store it? I was planning on keeping the calls in the server. Makes sense.

Or how can I fix the error where the client believes the instance does not exist

Replicated storage preferably. You could also clone the instance into replicated storage and return the clone.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.