I get this error although I have a primary part set.

game.Players.PlayerAdded:Connect(function(plr)
local char = plr.CharacterAdded:Wait()
if game.Workspace:WaitForChild("TrapBasics") then
for i, v in pairs(game.Workspace.TrapBasics:GetChildren()) do
	if v.Name == "TrapBasic" then
		if v.Dedication.Player.Value == "" then
			v.Name = plr.Name
            v.Dedication.Player.Value = plr.Name
            break
		end
end
end
end
char.Archivable = true
char:WaitForChild("Humanoid").Died:Connect(function()
	 plr.leaderstats.Score.Value = 0
	wait(6)
		game.Workspace.TrapBasics[plr.Name]:Destroy()
		wait()
		local level = game.ServerStorage.TrapBasic:Clone()
		level:SetPrimaryPartCFrame(game.Workspace.TrapBasics:FindFirstChild(plr.Name).PrimaryPart.CFrame) -- Error here (21)
		wait()

		level.Parent = game.Workspace.TrapBasics
		level.Name = plr.Name
		level.Dedication.Player.Value = plr.Name
end)
end)

Thanks!

1 comment

0

Never mind I fixed it, the issue was that I was trying to set the position before it had a parent