:Clone() returning nil

Im trying to make an attack on titan game and i want to clone the characters player model and parent it to serverstorage (essentially acting as a backup) so once the titan body dies i can clone it, tp to my desired position and give the player control of their human body again.

When i join the game im met with an error saying that im trying to index nil with .Name
Ive tried doing some debugging with pcall and other stuff but still dont know why.

	player.CharacterAdded:Connect(function(character)
		-- Wait for character to load fully
		local titanChoice = Instance.new("StringValue")
		titanChoice.Name = "TitanChoice"
		titanChoice.Value = "None" -- default or blank
		titanChoice.Parent = player
		character:WaitForChild("Humanoid")
		character:WaitForChild("HumanoidRootPart")
		print("Character before cloning:", character)
		if not character then
			warn("Character is nil! Cannot clone.")
			return
		end
		-- Clone the character model and store it in ServerStorag
		local storedModel = character:Clone()
		storedModel.Name = player.Name .. "_HumanBackup"
		storedModel.Parent = game:GetService("ServerStorage")
	end)
	
end)
1 Like

Instance.Archivable is set to false by default on characters, you need to enable it to clone characters.

1 Like

Hey, been a while since i was on the Forum, But ill try my best to assist you it seems that your trying to clone the character without checking if the Instance.Archivable Property is set to true which is disabled by default. Change this so you can Clone your Character.

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