How to make in-game Cameras that can take photos

You need to clear the viewport frame with ClearAllChildren(). What’s happening is that when you press the button, a copy of you is saved in it, and when you press it again, it copies and puts it in there again.

3 Likes

thank you! I hooked it up and it works PERFECTLY! I was stumped for a week on this, thanks for the help!

3 Likes

I actually did this because I wanted to make a very low frame rate camera, and it works fine! I just made a while true do on click so when you click it the security camera thing will work. Thanks a lot again!

1 Like

I am going to try to see if it will be able to work for a server instead of just locally.

3 Likes

I’m happy that you found it usefull, good luck :smile:

3 Likes

Wow dude, this is super cool! It’s gems like these that really widen my perspective to game possibilities - and sure, it takes some time for it to complete but still!

I have a question. So I’d love to be able to use this to make Image Gui elements from models, instead of taking a bunch of screenshots and cutting them out them manually. However, for a large number of models (I estimate I’ll need about 60-80) it might not be practical time-wise to take the snapshots while a loading screen is on.
Do you know a way I can save these images in Studio? I noticed that SelectionImageObject doesn’t change after the snap is taken.

2 Likes

(Sorry for late reply)

It’s a good question! Everytime you take a photo, the models will be saved in the Viewport (We could say that the viewport is a picture by itself), so if you want to save it down, simply just swap it with a new one and save the old one down to a folder

If you want a Viewport that can show all the models, you could simply just swap out the models inside of it, and they will be displayed as well (See the viewport as a seperate workspace)

I hope that answers your question! :smiley:

1 Like

Whenever it takes the picture, my character falls through the floor. Can anyone help?

3 Likes

Thanks, this really helped me out
I made some changes though, here’s how mine works now

local tele = 0

script.Parent.ClickDetector.MouseClick:Connect(function()
	script.Parent.ClickDetector.MaxActivationDistance = 0
	
	game.ReplicatedFirst.Gui.Camera:Destroy()
	game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
	game.Workspace.Camera.CFrame = game.Workspace.CameraModule.Cameramodel.ori.CFrame --ori is the main camera part
	local camthing = game.Workspace.Camera:Clone()
	camthing.Parent = game.ReplicatedFirst.Gui
	game.ReplicatedFirst.Gui.Picture.CurrentCamera = camthing
	game.Workspace.Camera.CameraType = Enum.CameraType.Custom
	
	game.ReplicatedFirst.Gui.Picture:ClearAllChildren()
	for _, Player in pairs(game.Players:GetPlayers()) do
		if tele == 1 then
			Player.PlayerGui.camt:Destroy()
		end
	end
	
	for i, v in pairs(game.Workspace:GetChildren()) do
		if v:IsA("BasePart") and not v.Parent:FindFirstChild("Humanoid") and not v:IsA("Terrain") and v.Parent ~= game.Workspace.CameraModule.Cameramodel then	
		v:Clone().Parent = game.ReplicatedFirst.Gui.Picture
		end
	end
	for c, Plr in pairs(game.Players:GetPlayers()) do
		Plr.Character.Archivable = true
		local PlrCopy = Plr.Character:Clone()
		PlrCopy.Parent = game.ReplicatedFirst.Gui.Picture
		PlrCopy.Humanoid.DisplayDistanceType = "None"
	end
	
	for _, Player in pairs(game.Players:GetPlayers()) do
		local Copy = game.ReplicatedFirst.Gui:Clone()
		Copy.Name = "camt"
		Copy.Parent = Player.PlayerGui
	end
	tele = 1
	wait(5)
	script.Parent.ClickDetector.MaxActivationDistance = 32
end)

One major difference in mine is that it copies the entire workspace, generally not a good thing to do, but I haven’t encountered any problems with it yet, I might use the Region3 method instead if I run into problems. You really helped me out, thank you for making this tutorial :+1:

2 Likes

changed again, it now works as a tool and can be used by multiple players and multiple displays (displays have been moved onto the camera itself)!

local tele = 0

script.Parent.Parent.Activated:Connect(function(plr)
	
	game.ReplicatedFirst.Gui.Camera:Destroy()
	game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
	game.Workspace.Camera.CFrame = script.Parent.Parent.lens.CFrame --"lens" is... well... the lens... what else did u expect?
	local camthing = game.Workspace.Camera:Clone()
	camthing.Parent = game.ReplicatedFirst.Gui
	game.ReplicatedFirst.Gui.Picture.CurrentCamera = camthing
	game.Workspace.Camera.CameraType = Enum.CameraType.Custom
	
	game.ReplicatedFirst.Gui.Picture:ClearAllChildren()
	for _, Player in pairs(game.Players:GetPlayers()) do
		if tele == 1 then
			Player.PlayerGui.camt:Destroy()
		end
	end
	
	for i, v in pairs(game.Workspace:GetDescendants()) do
		if v:IsA("BasePart") and not v.Parent:FindFirstChild("Humanoid") and not v:IsA("Terrain") then	
		v:Clone().Parent = game.ReplicatedFirst.Gui.Picture
		end
	end
	for c, Plr in pairs(game.Players:GetPlayers()) do
		Plr.Character.Archivable = true
		local PlrCopy = Plr.Character:Clone()
		PlrCopy.Parent = game.ReplicatedFirst.Gui.Picture
		PlrCopy.Humanoid.DisplayDistanceType = "None"
		PlrCopy.CameraTool:Destroy()
	end
	
	for _, Player in pairs(game.Players:GetPlayers()) do
		local Copy = game.ReplicatedFirst.Gui:Clone()
		Copy.Name = "camt"
		Copy.Parent = Player.PlayerGui
		Copy.Adornee = script.Parent.Parent.dis --"dis" is the display part
	end
	tele = 1
	wait(5)
end)
1 Like

Try to anchor the players HumanoidRootPart, that should fix it :smile:

I’m happy to hear that you found it usefull :smile:

1 Like

thank you so much for your feedback its now working without falling through the ground :smiley:

1 Like

nevermind i tried it again now and it seemed to do it again, it could have something to do with server lag. any ideas if i could switch to client?

You could try to make the image on each client, but I don’t know how it would affect performance unfortunately. It seems odd that they would just fall to the ground, are you sure you properly anchored all of them?

I was anchoring the humanoid root part from the player copy variable.

(also switched to local player but now it doesnt appear on screen)

Are you running this in a localscript placed in workspace? I believe you need to redo most of the script for the player itself

Yo man cool code I heavily edited it to make a decent video camera!

1 Like

I’m happy to hear that you found it usefull!

Hello @Ejo2012 !

I really appreciate your tutorial and I find it helpful.

But I have one question: Despite the fact that we also clone the parts that are inside the CameraFocus, they won’t show inside the photo?

What do I have to do to achieve this?

Thanks!