I have had this error before so I change the script but it still doesn't work! "Attempt to index nil with 'CFrame'"

	local SpawnPoint = ClonedMap:FindFirstChild("SpawnPoint")

	for _, player in pairs(game.Players:GetChildren()) do
		if player then
			player.Character:FindFirstChild("HumanoidRootPart").CFrame = SpawnPoint.CFrame
		end
	end

Line 5 teleports the player to spawn point/part. This is in a while true do loop, so after a few rounds I get the error, whats wrong?

2 comments

0

Try with WaitForChild("HumanoidRootPart) instead of FindFirstChild("HumanoidRootPart)

0

try to use Position instead of CFrame?