While working on a script to clone the player's character I've come across the problem that its not cloning. What am I doing wrong here?
script.Parent.Touched:Connect(function(part)
local Players = game:GetService("Players")
local player = Players:GetPlayerFromCharacter(part.Parent)
wait(1)
part.Reflectance = 0.2
wait(3)
part.Reflectance = 0.4
wait(3)
part.Reflectance = 0.6
wait(3)
part.Reflectance = 0.8
wait(5)
part.Reflectance = 1
local function crystalize()
if player.Character then
local c = player.Character:Clone()
c.Parent = workspace
c.Name = "SCP-409-1("..player.Name..")"
local d = c:GetChildren()
for i = 1, #d do
if d[i].className == "Accessory" then
d[i].Mesh.TextureId = "http://www.roblox.com/asset/?id=686337933"
d[i].Handle.Transparency = 0
d[i].Anchored = true
end
if d[i].className == "Part" then
if d[i].Name ~= "HumanoidRootPart" then
d[i].Anchored = true
d[i].Transparency = 0
if d[i].Name == "Head" then
if d[i]:FindFirstChild("face") then
d[i].face:Destroy()
end
end
end
end
end
end
player.Torso:Destroy()
end
crystalize(part)
end)
EDIT: Put the full script opposed to the cut out.
Output:
Workspace.SCPs.SCP-409.Freeze:19: attempt to index local 'c' (a nil value)

12 comments
With the players model you need to set Archivable to true before cloning the player.
It is set true but still nothing. If I need to post the whole script I can.
You probably also need to set the position of the model or it may just be falling off the map
All the original parts from the player are anchored before the clone is made.
What is "part"? Is this is a global? If it's from a touched event, it isn't being passed to your function "crystalize()". Include it by doing "crystalize(part)".
crystalize is in the function where local part is defined. Also tried crystal(part) and still getting the same thing.
Because, you really never got the character...
Can you that code as well? (The part where part is defined and function is called.)
If I need to I can post the full code if it makes things any easier.
Yes please
I edited the question desc and put the full script there.
Try making sure that it's a humanoid touching the part?