I would just make NPCSpawnPoint equal to a CFrame instead of a string. Apparently, it’s returning nil, meaning NPCSpawnPoint isn’t being assigned to any value as a variable.
local NPCSpawnPoint
if math.random(1, 2) == 1 then
NPCSpawnPoint = Vector3.new(-28, 91, -63.5)
elseif ChosenRandomNPCSpawnPoint == 2 then
NPCSpawnPoint = Vector3.new(-28, 91, -63.5)
end
if NPCSpawnPoint then
NewNPC:PivotTo(NewNPC:GetPivot() * CFrame.new(NPCSpawnPoint))
end