Attempt to index nil with 'Archivable'

Hey there, been on this issue for awhile now and cant get it to work at all.

  1. What do you want to achieve? Keep it simple and clear!
    Clone a Model (basically a NPC) on death

  2. What is the issue? Include screenshots / videos if possible!
    attempt to index nil with ‘Archivable’

    Error:
    ServerScriptService.ClonePlayer:12: attempt to index nil with ‘Archivable’ - Server -
    ClonePlayer:12

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Devfourms

function respawnClone(player, Player1)
	local playerToClone = player

	local function CloneMe(char) --a function that clones a player
		char.Archivable = true
		local clone = char:Clone()
		char.Archivable = false
		return clone
	end

	local Player2 = CloneMe(Player1)
	Player1:FindFirstChild("Humanoid").DisplayName = Player1.Name.. " / Player 1"

	Player2.Name = player.Name.. " / Player 2"
	Player2:FindFirstChild("Humanoid").DisplayName = Player2.Name
	Player2.HumanoidRootPart.Position = workspace.PlayerSpawn.Player2Spawn.Position
	Player2.Parent = workspace
	
	local player2Humanoid = Player2:FindFirstChild("Humanoid")

	player2Humanoid.Died:Connect(function()
		task.wait(game.Players.RespawnTime)
		respawnClone()
	end)
end

game.Players.PlayerAdded:Connect(function(player)
	local Player1 = player.Character or player.CharacterAdded:Wait()
	
	--task.wait(0.25)
	
	respawnClone(player, Player1)
end)

1 Like

Archivable can not be changed in a script. You can put a part with Archivable disabled and clone that

1 Like

respawnClone Has no parameters.
and Player1 should be called Character

1 Like

This error means that you’re trying to access a property ‘Archivable’, but the element of which you tried this does not exist (and is thus nil)

That means char is nil, when the function is called.

2 Likes

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