Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is player not being cloned and C a nil Value?

Asked by 6 years ago
Edited 6 years ago

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?

01script.Parent.Touched:Connect(function(part)
02    local Players = game:GetService("Players")
03    local player = Players:GetPlayerFromCharacter(part.Parent)
04    wait(1)
05    part.Reflectance = 0.2
06    wait(3)
07    part.Reflectance = 0.4
08    wait(3)
09    part.Reflectance = 0.6
10    wait(3)
11    part.Reflectance = 0.8
12    wait(5)
13    part.Reflectance = 1
14 
15    local function crystalize()
View all 44 lines...

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)

1
With the players model you need to set Archivable to true before cloning the player. User#5423 17 — 6y
0
It is set true but still nothing. If I need to post the whole script I can. BlauKitten 88 — 6y
0
You probably also need to set the position of the model or it may just be falling off the map User#5423 17 — 6y
0
All the original parts from the player are anchored before the clone is made. BlauKitten 88 — 6y
View all comments (8 more)
0
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)". Cousin_Potato 129 — 6y
0
crystalize is in the function where local part is defined. Also tried crystal(part) and still getting the same thing. BlauKitten 88 — 6y
0
Because, you really never got the character... greatneil80 2647 — 6y
0
Can you that code as well? (The part where part is defined and function is called.) Cousin_Potato 129 — 6y
0
If I need to I can post the full code if it makes things any easier. BlauKitten 88 — 6y
0
Yes please Cousin_Potato 129 — 6y
0
I edited the question desc and put the full script there. BlauKitten 88 — 6y
0
Try making sure that it's a humanoid touching the part? B_rnz 171 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Try enabling "Archivable " right before you clone it.

(Line 17-ish):

1local character = player.Character
2 
3character.Archivable = true
4 
5local c = character:Clone()
6 
7character.Archivable = false
1
That seemed to do the trick. Thank you! BlauKitten 88 — 6y
Ad

Answer this question