Attempt to index nil with 'Name'

Basically,

local Player = game:GetService('Players').LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()
local function CharacterCreation()
	if (Character) then
		print('start.')
		local Fk = Character:Clone()
		warn(Fk.Name)
		fk = Fk
		Fk.HumanoidRootPart.Anchored = true
		Fk.Parent = Camera
		Fk.Name = 'Clone'
		Fk:SetPrimartPartCFrame(workspace.Map.CameraParts.CharSpawn.CFrame)
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = workspace.Map.CameraParts.CharSpawnCamera.CFrame
		TweenOut(script.Parent.Interface)
	
		TweenIn(script.Parent.CharacterCreation)
	end
end

Why this doesn’t works…
it says ‘Fk’ is nil but, its not…
how can i fix this?

I also tried this

local Fk = workspace:WaitForChild(Player.Name):Clone()

and it doesn’t works… wth

The character model has the Archivable value disabled by default. This means the character won’t be saved when using some services which allow you to do so. However as a side-effect cloning the model will always return nil.

In other words, you should be able to resolve this issue by enabling the Archivable property of the character model before cloning, and then disabling it again right after.

1 Like

Hey, thanks for answer
look:

local function CharacterCreation()
	local find = Player.Character
	if (find) then
		print('found',find.Name)
		FakeChar = find:Clone() 
		FakeChar.Archivable = true
		FakeChar.Name = Player.Name..'fakechar'
		FakeChar.Parent = workspace.CurrentCamera
		FakeChar:SetPrimaryPartCFrame(workspace.Map.CameraParts.CharSpawn.CFrame)
		Camera.CameraType  = Enum.CameraType.Scriptable
		Camera.CFrame = workspace.Map.CameraParts.CharSpawnCamera.CFrame
	else
		print('couldnt found WTF')
	end
end

it errors: attempt to index nil with ‘Archivable’
No idea why because it prints, ‘found’ (and plr name)

Do that :

local function CharacterCreation()
	local find = Player.Character
	if (find) then
		print('found',find.Name)
        local Char = find
        Char.Archivable = true
        FakeChar = Char:Clone()
		FakeChar.Archivable = false
		FakeChar.Name = Player.Name..'fakechar'
		FakeChar.Parent = workspace.CurrentCamera
		FakeChar:SetPrimaryPartCFrame(workspace.Map.CameraParts.CharSpawn.CFrame)
		Camera.CameraType  = Enum.CameraType.Scriptable
		Camera.CFrame = workspace.Map.CameraParts.CharSpawnCamera.CFrame
	else
		print('couldnt found WTF')
	end
end

If it’s working, mark this as the solution so we know it’s fixed ^^

1 Like