Can't pass instance with Remote Event

Can’t pass the value (snipped from org)

server

            local attachment = Instance.new("Attachment")

            attachment.Parent = humanoidRootPart

            print(attachment)

            Events.RemoteEvent:FireClient(plr, attachment)

client

  Events.RemoteEvent.OnClientEvent:Connect(function(attachment)
    print(attachment)
  end

output:

  1. Attachment
  2. nil

Are you sure its a bindable event not a remote event?
If it’s remote, most likely you forgot that the Player who sent the event gets inserted as the first argument, so your arguments are pushed to the right one.

Oh yes, it’s a remote event yea the argument I want to send is the attachment but it comes up as nil

I had this problem a while back.
So basically you haven’t given the server time to replicate the instance to the clients, therefore the client cant do anything with it or even see it.
Its like the server is ordering the client a box of cookies with a 30 minute delivery time, and then asking the client if the cookies were good 5 seconds after they were ordered.
to fix this, try giving the server a bit of time to replicate to the client, or just send the name of it to the client and have them use :WaitForChild() to wait for it.
Remember, due to ping differences it will take each client a different amount of time to receive the servers info

1 Like

I in fact thought that was the problem, but I do I solve it? I wanted to use wait() but I felt like that wouldn’t be a good solution since what if the client was still loading?

You could try and send the name of the attachment instead of the attachment itself, and then have the client use :WaitForChild()

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