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

Why Wont my cloning/Mirror LocalScript work?

Hi Again! So I'm testing to make a sort of mirror thing, and i've been trying this script, but the output keeps saying

Players.pokemonzizzle8383.PlayerScripts.LocalScript:9: attempt to index nil with 'Parent'  

Is it due to it being in a local script? I don't think it is, Can i please have help?

-- My code:

local RunService = game:GetService("RunService")

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait();
local createclone = function()

	local origin = workspace:FindFirstChild(Player.Name)
	local clone = origin:Clone()
	clone.Parent = workspace
	clone.HumanoidRootPart.CFrame = CFrame.new(origin.HumanoidRootPart.CFrame.X * -1, origin.HumanoidRootPart.CFrame.Y, origin.HumanoidRootPart.CFrame.Z * -1)
end


-- function call here--

All help is Appreciated ^-^

1 answer

✓ Accepted answer

It's because the Archivable property of a character is set to false.

local function CloneChar()
	character.Archivable = true
	local clone = character:Clone()
	character.Archivable = false
	return clone
end



--- your script 


local clone = CloneChar()

2 comments

1

Sorry about that

0

@WizyTheNinja The clone still isn't spawning with your method, could you test it on your end?

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