Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

"Attempt to index local 'clone' (a nil value)?"

I made a tool that copies your character when you activate it, however I keep getting the error: Players.Player1.Backpack.Mirage/Remnant.LocalScript:9: attempt to index local 'clone' (a nil value) I have no idea what this means nor how it can be rectified. The script is here:

local name = game.Players.LocalPlayer.Name .. "RNT"

script.Parent.Activated:connect(function()
	if not game.Workspace:FindFirstChild(name) then
		local m = Instance.new("Model")
		m.Name = name
		m.Parent = game.Workspace
		local clone = game.Players.LocalPlayer.Character:clone()
		clone.Parent = m
		clone.Torso.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector*2
		clone.Name = ""
		clone.Humanoid.MaxHealth = 0
	else
		game.Workspace[name]:destroy()
	end
end)

Can anyone help?

3 comments

1

I am pretty sure you can't clone the player, I tried it before

0

you're right, i just tested it

0

Well that sucks

1 answer

✓ Accepted answer

You can clone the player, but only when the model's Archivable value is set to true. It basically means it gets remembered by the game. Never set something's Archivable value to false, it'll delete itself the next time you run/load your game.

So, try and set it to true. Also, call Clone() with capitals, the lowercase version is deprecated:

part:Clone()

Hope I helped!

~TDP

This discussion is preserved as it was. New answers, comments, and votes are closed.