So, I am working on a game and I am getting an error for cloning the character, it says its a nil value. Please help
game.Players.PlayerAdded:connect(function(p)
wait(7)
local c = p.Character
if c ~= nil then
c = c:Clone()
else
error("Not Working")
end
c.Parent = workspace
c.Name = ""
c.HumanoidRootPart.CFrame = CFrame.new(workspace.Points.Spawn.Position)
local humanoid = c:WaitForChild("Humanoid")
wait(2)
humanoid:MoveTo(Vector3.new(-46.5, 5.85, 100))
wait(1.08)
humanoid:MoveTo(Vector3.new(-5.5, 5.85, 100))
wait(2.30)
wait(5)
humanoid:MoveTo(Vector3.new(-46.5, 5.85, 100))
wait(2.30)
humanoid:MoveTo(Vector3.new(-46, 5.85, 117.5))
end)
This is the error I'm getting:
21:12:46.194 - Workspace.Script:9: attempt to index local 'c' (a nil value)

1 comment
I actually just answered a question that (I think) has the exact same issue you do: https://scriptinghelpers.org/questions/56553/#55261