I was created a Viewport not taking player model

I was created a Camera taking picture with Viewport but this not taking Player Models into viewport
This is script

local gui = script.Parent
local viewportFrame = gui:WaitForChild("ViewportFrame")

local viewportCamera = Instance.new("Camera")
viewportCamera.FieldOfView = 70
viewportFrame.CurrentCamera = viewportCamera

local cameraPart = gui.Adornee.Parent:WaitForChild("Camera")
local detectZone = gui.Adornee.Parent:WaitForChild("DetectZone")
local prompt = detectZone:WaitForChild("ProximityPrompt")

local debounce = false

prompt.Triggered:Connect(function()
	if debounce then return end
	debounce = true
	prompt.Enabled = false

	viewportFrame:ClearAllChildren()

	local sceneModel = Instance.new("Model")
	sceneModel.Name = "ViewportScene"
	sceneModel.Parent = viewportFrame

	viewportCamera.CFrame = cameraPart.CFrame * CFrame.new(0, 3, -8)

	local lightPart = Instance.new("Part")
	lightPart.Anchored = true
	lightPart.CanCollide = false
	lightPart.Transparency = 1
	lightPart.Size = Vector3.new(1, 1, 1)
	lightPart.CFrame = cameraPart.CFrame
	local light = Instance.new("PointLight")
	light.Brightness = 4
	light.Range = 60
	light.Color = Color3.fromRGB(255, 255, 200)
	light.Parent = lightPart
	lightPart.Parent = sceneModel

	for _, obj in ipairs(workspace:GetChildren()) do
		local isValid =
			not obj:IsA("Terrain") and
			obj ~= cameraPart and
			obj ~= detectZone and
			obj.Name ~= "Players"

		if isValid then
			local success, clone = pcall(function()
				return obj:Clone()
			end)

			if success and clone then
				for _, part in ipairs(clone:GetDescendants()) do
					if part:IsA("BasePart") then
						part.Anchored = true
						part.CanCollide = false
					end
				end

				if clone:IsA("Model") then
					clone:MakeJoints()
				end

				clone.Parent = sceneModel
			end
		end
	end

	task.wait(3)
	prompt.Enabled = true
	debounce = false
end)


This taking eversingle thing in Workspace without Player Model.
I can’t figure out what is problem.

Use :GetDescendants() instead of :GetChildren()

Normally if you want to clone a character you would obtain the player’s name, which is shared on their character:

- workspace
| - PlayerName < their character (Model)
- Players
| - PlayerName < their Player Instance

in which case it is as simple as

workspace[Name]:Clone()

However player characters are non-archivable by default, which means you cannot clone them directly. Simply set it to true before cloning:

workspace[name].Archivable = true
workspace[name]:Clone()
1 Like

This is Found the problem Thanks for helping.

and other Users thanks to trying help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.