How to check for a Client part on the server?

In the Video Below, There are 2 parts: PickupPart, and BluePart.

The PickupPart is A Server-sided part.

The BluePart is a part created by the Client after He/She presses “E” on the PickupPart. So the BluePart is a Client-sided part.


ScreenShot of PickupPart Touching BluePart

As you Can See the BluePart Aways touches the PickupPart.

What I need to figure out, is how to get the PickupPart to Detect the BluePart (a Client part).
Please help!

When the PickupPart Touched the BluePart on the client side (detect with a local script), Fire a Remote Event to the server. The server side of the remote event will then fire every time the parts touch. You might want to add some sort of Debounce to stop it from firing to often.
The Server part can detect the client part and vise-versa on the client side. You just have to notify the server that it happened.

Thank you for the quick response :slight_smile: but are you saying to add a local detecting script into the PickupPart?

Yes. As you can only detect the BluePart on the client side, but you can detect the PickupPart on both the client and the server. Using a LocalScript from either within one of the parts or somewhere within the client (player) and connecting it to the parts by locating them wherever they are in the Workspace will allow you to detect their interactions. I would local-ize the parts somewhere in the localscript for ease of access.

For example;

local bluePart = game.Workspace.BluePart
local PickupPart = game.Workspace.PickupPart

PickupPart.Touched:Connect(function(hit)
    if hit = bluePart then
        game.ReplicatedStorage.RemoteTouchedEvent:FireServer()
    end
end)

Can I ask what your use-case for this is?

Yes. I have a script that allows players to Pick-up/Move/Rotate, allowed parts, to interact with a story. But the purpose of this function is not pick-up all the parts in the game, just the one being selected.

If you use the mouse you could do Mouse and TargetFilter. Otherwise you could use Raycasting and FindPartOnRayWithIgnoreList to detect what you want to select. These are other options than what you are doing that allow you to ignore parts. I would use FindPartOnRayWithWhitelist with raycasting to detect if you are pointing towards the PickupPart or whatever as you can just add the part to the Whitelist. For this to work you would have to learn raycasting though.