Please explain why this is the way it is?

I addressed this topic in a direct message. Please refrain from discussing these matters in this forum.

While I can screenshot the flagged portion, I won’t post any flagged content here until the issue is resolved and it’s clear that my statement was accurate.

It is funny how almost nobody is actually trying to answer the question here.

You cannot pass baseparts (or models for that matter) through remote events. You can only pass their references.

If the reference is read as nil it could mean that you have streaming mode enabled (it is off by default), but most likely the part has not been parented to workspace or ReplicatedStorage by Server. Those kind of parts are not accessible by a client.

1 Like

You can, I have done it myself. You can pass any instance through remotes that are both readable by the client and server. Haven’t I just said this before (oh wait it got flagged for some reason).

Like I said, you are not passing the instance, but the reference.

The server creates the part that both server and client have access to from the beginning (provided it is loaded on client). The server then passes the reference so the client knows which instance it should do something to. That part is still on the server and cannot be modified by the client due to filtering anyway.

Sorry, you were saying?

image

-- server
local p = Instance.new'Part'
p.Name = 'part1234'
p.Parent = workspace

game.Players.PlayerAdded:Connect(function(plr)	
	task.wait(3)
	script.Parent:FireClient(plr,p)
	print('fired to client')
end)
--client
local r = workspace:WaitForChild('RemoteEvent')

print('got remote')

r.OnClientEvent:Connect(function(part)
	print('remote',part,part:GetFullName())
end)

Variable part is NOT the part itself. It is a VARIABLE that holds a REFERENCE to the part on both server and client. You cannot pass the instances through remotes. For example try to pass a tween through a remote. I’ll wait.

My educated guess was that the OP is trying to pass the part through the remote, and since that part is not available on client (due not being loaded or not being parented properly) client has no access to it.

1 Like

Okay first of all, passing an instance through a remote is referring to the reference yes. You are not cloning the part or anything. A tween is also an instance. I just tested this by parenting the tween to workspace. Like all things created by Instance.new(), anything without a parent will be in a cache. You can simply reparent it back to workspace on the server and it will print back as true.

local p = Instance.new'Part'
p.Name = 'part1234'
p.Parent = workspace

local tween = game:GetService('TweenService'):Create(p,TweenInfo.new(
	0.5,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	10,
	true), {Position = Vector3.new(0,10,0)}
)
tween.Parent = workspace

game.Players.PlayerAdded:Connect(function(plr)	
	task.wait(3)
	script.Parent:FireClient(plr,p,tween)
	print('fired to client')
end)

Respectfully, I don’t understand why it being a reference is relevant. You are still passing a part.

1 Like
Respectfully, I don’t understand why it being a reference is relevant. You are still passing a part.

That is because most of the newbie coders think they can “give” parts to clients through remote events. For example after opening a chest, reward parts are being send to a client via a remote.

They need to understand that for client to have access to a any model or part, that part needs to be parented to workspace or ReplicatedStorage. Then that client can clone that part if they choose to. The server can only tell them which part they must clone.

But honestly I have no idea if that is the problem here, so I could be wrong.