Player Character is Nil, why?

So hello guys, my problem is Player Character. I really don’t know why this is Nil.
I am trying to show Player Character in a ViewPort, but the Character is Nil, why?

LocalScript :

local Player = game.Players.LocalPlayer

local MenuGui = script.Parent

local Rad = math.rad

local Rand = math.random

local Replicated_Storage = game:GetService("ReplicatedStorage")

local Character = Player.Character or Player.CharacterAdded:Wait()

local TweenService = game:GetService("TweenService")

--//Code

local Clone = Character:Clone()

local PrimaryPart = Clone.PrimaryPart

local Offset = CFrame.new(0, 0, 7)

local ViewportClone = script.Parent.ViewportFrame

--//Sets

local Camera = Instance.new("Camera")

Camera.CFrame = (PrimaryPart.CFrame * CFrame.Angles(0,Rad(180),0)) * Offset

ViewportClone.CurrentCamera = Camera

Camera.Parent = ViewportClone

Clone.Parent = ViewportClone.World

ViewportClone.Parent = MenuGui

--//Animation

local Shadow = script.Shadow:Clone()

local Espada = script.Espada:Clone()

local Idle = script.Idle

Espada.Parent = Clone

Espada.HandleSword.Espada.Part0 = Clone["Right Arm"]

Clone:AddAccessory(Shadow)

for i,v in pairs(Clone:GetChildren()) do

if v:IsA("CharacterMesh") then

v:Destroy()

end

end

Clone.Humanoid.Animator:LoadAnimation(Idle):Play()

while true do

Offset = CFrame.new(Vector3.new(Rand(-1,1),Rand(-1,1),7))

CameraCFrame = (PrimaryPart.CFrame * CFrame.Angles(0,Rad(180),0)) * Offset

Camera.CFrame = Camera.CFrame:lerp(CameraCFrame,0.05)

wait()

end

https://gyazo.com/32f27f2d5d96f5577cb9879296ab570b

1 Like

Turn off the “Archivable” property of the character, then clone it.

1 Like

Clone’s can’t be cloned because they have the Archivable property set to false. To fix this, just set it to true:

Character.Archivable = true
local Clone = Character:Clone()
Character.Archivable = false
2 Likes

It worked i can clone the character now, but… Just the model “Childs” of Character (Humanoid and other components) does not exist so how i fix it?

I tryed to check the number of childs but don’t exist nothing

Code:

print(#Clone:GetChildren())

Output

image

Nvm i fixed this, so anyways thx for helping guys :D.