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

Player Clone doesnt work?

I tried making a copy of myself as for a shadow clone jutsu. Is there a way to make it work? Feel free to add on to the script.

player = game.Players.LocalPlayer
mouse = player:GetMouse()

mouse.KeyDown:connect(function(key)
	if key:lower() == "x" then
		local clone = player.Character:Clone()
		clone.Parent = game.Workspace
		clone.Position = player.Character.Torso.Position + Vector3.new(5, 0, 5)
	end
end)

1 answer

For some reason you cannot clone the character, So the only way to do this is by cloning everything on the inside of the character and inserting it into a model with the same name as the character:


#Final Product Use UserInputService instead of KeyDown since KeyDown is deprecated.

--LocalScript
local uis = game:GetService("UserInputService")
local plyr = game:GetService("Players").LocalPlayer

uis.InputBegan:connect(function(key,processed)
	if key.KeyCode == Enum.KeyCode.X and not processed then
		local m = Instance.new("Model",workspace)
		for _,obj in pairs(plyr.Character:GetChildren()) do
			obj:clone().Parent = m
		end
		m.Name = plyr.Name
		m:MakeJoints()
	end
end)

Hope it helps!

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