How can I send an instance's position from server to client

I am sorry for posting here a lot however I have a very simple problem that I am unable to fix. I have looked over many scripts yet none of them are able to fix my problem.

I am trying to make a player queue that when you click a part it moves your camera. I was able to work the queue part but I am unable to move the camera. When my script is ran the camera is turned to scriptable but it keeps the camera in one place and doesn’t move it to the part I want it to, but I would also like the part to be based off of the server script.

Here is a sample from Server Side:

local function joinQueue(player)
	if not hasPlayer(playerQueue, player) then
		numbOfPlayers += 1
		playerQueue[numbOfPlayers] = player
		local camerapart = script.Parent:WaitForChild("CameraPart")
		game:GetService("ReplicatedStorage").MoveCamera:FireClient(player, camerapart)
	end
end

And here is what I have on the client side:

local function onPlayerClick(player, camerapart) 
	local Player = game.Players.LocalPlayer
	local Camera = workspace.CurrentCamera
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = camerapart.CFrame	
end

game:GetService("ReplicatedStorage").MoveCamera.OnClientEvent:Connect(onPlayerClick)

Everything seems to work but the camera, which when you click the part it stays in place, not moving with the player or moving to the part that is defined (The part is inside the part with the clickdetector)

Thank you!

1 Like

The player parameter isn’t passed to the client, so the arguments for onPlayerClick should just be camerapart.

I tried that, once I added the player peramiter it started at scripting the camera

(player, camerapart) 

player is the reference to the part and camerapart is a reference to nil.