Can you make a spectate script?

  1. What do you want to achieve? Keep it simple and clear! I wanna make a spectate to the NPC script like in Scary Teacher. Do you need Viewport Frames to do that? Is this even possible?

I haven’t seen anything like this post. If it’s not possible well then- no.

To make it clear, it looks like this…
image

I don’t know why the clothes aren’t loading

local RunService = game:GetService("RunService")

local ViewportFrame = script.Parent
local ViewportCamera = Instance.new("Camera")
local Instances = ViewportFrame.Instances -- a folder
local SpectateTarget = game:GetService("Players").LocalPlayer.Character:WaitForChild("Head") -- change to the target
local CameraOffset = CFrame.new(0, 0, 0) -- offset [ optional ]

ViewportFrame.CurrentCamera = ViewportCamera

RunService.RenderStepped:Connect(function()
	if SpectateTarget then
		ViewportCamera.CFrame = SpectateTarget.CFrame * CameraOffset
	end
	
	Instances:ClearAllChildren()

	for i, Parts in ipairs(game.Workspace:GetDescendants()) do
		pcall(function()
			local ClonedPart = Parts:Clone()

			ClonedPart.Parent = Instances
		end)
	end
end)

You need to clone the character model in its entirety (as opposed to its parts individually), certain aspects of a character’s appearance are only rendered if certain criteria is met (character is a model that contains a humanoid instance etc.).