My code is like this:
script.Parent.Touched:Connect(function(V) if V.Parent:FindFirstChildWhichIsA("Humanoid") and V.Parent:FindFirstChildWhichIsA("Humanoid").Name ~= "Zombie" then local Cloned = V.Parent:Clone() -- I think it's the point. end end)
And the output said Cloned is a NIL VALUE What's going on!?
Assuming a player's character touched this, or some other object whose Archivable
property is assigned to false, that is your issue.
By default, the character model is not Archivable
. This property determines if an instance can be cloned.
Before cloning, simply assign Archivable
to true;
local Players, Workspace = game:GetService("Players"), game:GetService("Workspace") script.Parent.Touched:Connect(function(part) local client = Players:GetPlayerFromCharacter(part.Parent) if not client then return -- exit out the function since it wasn't a player who touched this part end client.Character.Archivable = true local clone = client.Character:Clone() clone.Parent = Workspace end)
Notice I used better identifiers, and a more reliable way of verifying that a player touched it.