ViewportFrames not behaving

The ViewportFrames aren’t really behaving how they should. I have the character spawn and then I clone it to the ViewportFrame. Code:

wait(0.33)
game.Players.LocalPlayer.Character.Archivable = true
local fakeChar = game.Players.LocalPlayer.Character:Clone()
fakeChar.Name = ""
fakeChar.Humanoid.DisplayName = ""
fakeChar.Parent = script.Parent
local cam = Instance.new("Camera")
script.Parent.CurrentCamera = cam
cam.Parent = script.Parent
cam.CFrame = CFrame.new(Vector3.new(0, 4, -7), fakeChar.Head.Position)

Sometimes it does this:
normal

Other times, with no script changes, it does this:
abnormal

Can anyone explain what the problem might be here?

1 Like

I’m not too familiar with Cameras however, it could be due to the CameraType.

I would suggest something like:

local Camera = Instance.new("Camera")
Camera.CameraType =enum.CameraType.Scriptable
Camera.Parent = script.Parent
Camera.CFrame = CFrame.new(Vector3.new(0, 4, -7), fakeChar.Head.Position)

script.Parent.CurrentCamera = Camera
1 Like

On top of what @OlTaru mentioned with CameraType, make sure when you’re cloning the character, that you anchor HumanoidRootPart.

1 Like

@OlTaru + @Katzenpunk

Still happening, but thanks.

Fixed. Just needed to set the CFrame of the fakeChar.