So I'm trying to make a zombie script where anyone that dies gets infected. In order to do this, I need to clone the player but I get this error message saying;
16:38:33.643 - Workspace.Arcerion.zombify:5: attempt to index local 'zombie' (a nil value)
So the issue with this, I assume is because Roblox doesn't allow cloning a player's character, but I've seen people do it before. Now I could always create a npc that transforms into the character, but I know that there's another way to do this.
Here is the code I've sent, it's really simple because let's be honest when I script and run into an issue I want to solve it before continuing. I just can't resolve this issue, so I'm asking for help.
Code;
local character = script.Parent local zombie = character:clone() zombie.Parent = workspace local rooty = character:FindFirstChild("HumanoidRootPart") if rooty ~= nil then zombie:MoveTo(rooty.Position) end
By doing some reading of your code, I got your solution. The issue of your code is that you did not enable Archivable which is a property of the characters model. So if you do:
local character = script.Parent character.Archivable = true local zombie = character:Clone() character.Archivable = false zombie.Parent = workspace local rooty = character:FindFirstChild("HumanoidRootPart") if rooty ~= nil then zombie:MoveTo(rooty.Position) end
That should do it, let me know if you have anymore issues!