How would I replicate Polaroid Camera to all clients?

  1. What do you want to achieve? Replicated Polaroid Camera on all clients (or server, but I’m sure it’s impossible).

  2. What is the issue? I’ve made a very simple polaroid camera tool that’s capable of creating polaroid pictures. It works via ViewportFrames so there’s no way of it working on the server side. It creates separate tool with reference model (polaroid frame) and attaches surface gui with ViewportFrame to the polaroid. The issue with this is that it is not replicated across server or clients, so for other people I’d be holding air with no picture instead of a polaroid.
    image

  3. What solutions have you tried so far? So far I tried creating polaroid on server and blatantly cloning viewport to it which obviously didn’t work. I tried creating viewport frame and all the parts from the scratch which lead to even more issues.

The script is quite big so I will send y’all only the most important parts.

  • viewmodel - ViewPort Frame
  • getObjectsInView() - function that detects instances in camera’s view (model or part)
  • addCharacter() - function that creates Humanoid character’s clone.
RS.Heartbeat:Connect(function()
	if equipped then
		for _, object in ipairs(viewmodel:GetChildren()) do
			if not object:FindFirstChildWhichIsA("Humanoid") then
				object:Destroy()
			else
				for _, part in ipairs(object:GetChildren()) do
					if part:IsA("BasePart") then
						part.CFrame = game.Workspace:WaitForChild(object.Name):WaitForChild(part.Name).CFrame
					end
				end
			end
		end

		local objects = getObjectsInView()

		for _, object in pairs(objects) do
			if not object:FindFirstChildWhichIsA("Humanoid") then
				local clone = object:Clone()
				if clone then
					clone.Parent = viewmodel
				end
			else
				if not viewmodel:FindFirstChild(object.Name) then
					addCharacter(object)
				end
			end
		end

		SpaceCamera.CFrame = attach.WorldCFrame
	end
end)

actualtool.Activated:Connect(function()
	local tool = Instance.new("Tool")
	local handle = game.ReplicatedStorage:WaitForChild("ReferenceModel"):Clone()
	handle.Parent = tool
	handle:WaitForChild("Handle").Parent = tool
	tool.GripPos = Vector3.new(0.9,-0.5,0)
	tool.Parent = Player.Backpack

	local viewmodelclone = viewmodel:Clone()
	local surface = Instance.new("SurfaceGui")
	surface.Enabled = false
	surface.Parent = Player.PlayerGui
	surface.Adornee = handle:WaitForChild("DecalPart")
	surface.Face = Enum.NormalId.Back
	viewmodelclone.Parent = surface
	viewmodelclone.BorderSizePixel = 0
	
	tool.Equipped:Connect(function()
		surface.Enabled = true
		TS:Create(ActualCamera, TweenInfo.new(0.5, Enum.EasingStyle.Quad), {FieldOfView = 50}):Play()
	end)

	tool.Unequipped:Connect(function()
		surface.Enabled = false
		TS:Create(ActualCamera, TweenInfo.new(0.5, Enum.EasingStyle.Quad), {FieldOfView = 70}):Play()
	end)
end)
1 Like

I don’t know if this’ll work but I feel like you should try get it when the tool is activated on the server and fire a RemoteEvent to all the clients doing what you want to replicate to all the clients.

So you could have something like

actualtool.Activated:Connect(function()
      remoteEvent:FireAllClients()
end)

and then replace the activated in the local script with

function picture()
-- Put the picture code here
end

event.OnClientEvent:Connect(picture)

Something like that might work - This thread is pretty old so I don’t know if you’ve already solved it - If it’s already solved maybe put something like “[SOLVED]” in the title or something like that.

Edit:
I think it will works as in your code it looks like you’re only creating the viewport frame on the client that has got the picture and not all the others - meaning only that client (player) can see it.